openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #04450
[Merge] lp:~camptocamp/sale-wkfl/7.0-fix_dropshipping_1287779-afe into lp:sale-wkfl
Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/sale-wkfl/7.0-fix_dropshipping_1287779-afe into lp:sale-wkfl.
Requested reviews:
Sale Core Editors (sale-core-editors)
Related bugs:
Bug #1287779 in Sales - Workflow and Organization: "sale_dropshipping: no dropshipping (by default) if stock available"
https://bugs.launchpad.net/sale-wkfl/+bug/1287779
For more details, see:
https://code.launchpad.net/~camptocamp/sale-wkfl/7.0-fix_dropshipping_1287779-afe/+merge/209499
When a product is configured as make_to_order, the existing stock must not be considered to compute sale flow.
added a test documenting the various paths for this feature.
--
https://code.launchpad.net/~camptocamp/sale-wkfl/7.0-fix_dropshipping_1287779-afe/+merge/209499
Your team Sale Core Editors is requested to review the proposed merge of lp:~camptocamp/sale-wkfl/7.0-fix_dropshipping_1287779-afe into lp:sale-wkfl.
=== modified file 'sale_dropshipping/__openerp__.py'
--- sale_dropshipping/__openerp__.py 2013-11-11 09:37:37 +0000
+++ sale_dropshipping/__openerp__.py 2014-03-05 16:59:43 +0000
@@ -55,7 +55,8 @@
""",
"init_xml": [],
"demo_xml": [],
- "test": [],
+ "test": ['test/test_sale_policy_procurement.yml',
+ ],
"update_xml": ["purchase_view.xml", "sale_view.xml", "product_view.xml", "stock_view.xml"],
'images': ['images/purchase_to_sale.png'],
'installable': True,
=== modified file 'sale_dropshipping/product.py'
--- sale_dropshipping/product.py 2013-11-11 10:16:33 +0000
+++ sale_dropshipping/product.py 2014-03-05 16:59:43 +0000
@@ -52,9 +52,11 @@
return False
for product in self.browse(cr, uid, ids):
- if 'qty' in context:
+ if product.procure_method == 'make_to_order':
+ res[product.id] = is_direct_delivery_from_suppliers(product)
+ elif 'qty' in context:
# TODO deal with partial availability?
- if product.virtual_available < context['qty']:
+ if product.virtual_available < context['qty']:
res[product.id] = is_direct_delivery_from_suppliers(product)
else: # Available in stock
res[product.id] = False
=== modified file 'sale_dropshipping/sale.py'
--- sale_dropshipping/sale.py 2014-02-10 16:47:16 +0000
+++ sale_dropshipping/sale.py 2014-03-05 16:59:43 +0000
@@ -41,7 +41,8 @@
if product:
context2 = {'lang': lang,
'partner_id': partner_id,
- 'qty': qty}
+ 'qty': qty,
+ }
product_obj = self.pool.get('product.product').browse(cr, uid, product,
context=context2)
if product_obj.is_direct_delivery_from_product:
=== added directory 'sale_dropshipping/test'
=== added file 'sale_dropshipping/test/test_sale_policy_procurement.yml'
--- sale_dropshipping/test/test_sale_policy_procurement.yml 1970-01-01 00:00:00 +0000
+++ sale_dropshipping/test/test_sale_policy_procurement.yml 2014-03-05 16:59:43 +0000
@@ -0,0 +1,111 @@
+-
+ I create a product with procure method MTS
+-
+ !record {model: product.product, id: prod_mts}:
+ name: testproduct mts
+ procure_method: make_to_stock
+ supply_method: buy
+ seller_ids:
+ - name: base.res_partner_1
+ min_qty: 1
+ product_uom: 1
+ direct_delivery_flag: True
+-
+ I create a product with procure method MTO
+-
+ !record {model: product.product, id: prod_mto}:
+ name: testproduct mto
+ procure_method: make_to_order
+ supply_method: buy
+ seller_ids:
+ - name: base.res_partner_1
+ min_qty: 1
+ product_uom: 1
+ direct_delivery_flag: True
+-
+ I create SO for 3xMTS Product
+-
+ !record {model: sale.order, id: so_mts}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: prod_mts
+ product_uom_qty: 3
+-
+ The so line should have sale_flow set to dropshipping
+-
+ !assert {model: sale.order, id: so_mts, string: wrong so line sale_flow state}:
+ - order_line[0].sale_flow == 'direct_delivery'
+-
+ I create SO for 3xMT0 Product
+-
+ !record {model: sale.order, id: so_mto}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: prod_mto
+ product_uom_qty: 3
+-
+ The so line should have sale_flow set to dropshipping
+-
+ !assert {model: sale.order, id: so_mto, string: wrong so line sale_flow state}:
+ - order_line[0].sale_flow == 'direct_delivery'
+-
+ I create some stock (5 units) for each product
+-
+ !record {model: stock.picking.in, id: in_pick}:
+ type: in
+ move_lines:
+ - product_id: prod_mto
+ product_qty: 5
+ product_uom: 1
+ location_id: stock.stock_location_suppliers
+ location_dest_id: stock.stock_location_stock
+ - product_id: prod_mts
+ product_qty: 5
+ product_uom: 1
+ location_id: stock.stock_location_suppliers
+ location_dest_id: stock.stock_location_stock
+-
+ !python {model: stock.picking.in}: |
+ self.action_move(cr, uid, [ref("in_pick")])
+-
+ !assert {model: product.product, id: prod_mto, string: wrong so stock_level}:
+ - qty_available == 5
+-
+ I create SO for 3xMTS Product
+-
+ !record {model: sale.order, id: so_mts2}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: prod_mts
+ product_uom_qty: 3
+-
+ The so line should have sale_flow set to normal
+-
+ !assert {model: sale.order, id: so_mts2, string: wrong so line sale_flow state}:
+ - order_line[0].sale_flow == 'normal'
+-
+ I create SO for 10xMTS Product
+-
+ !record {model: sale.order, id: so_mts3}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: prod_mts
+ product_uom_qty: 10
+-
+ The so line should have sale_flow set to drop shipping
+-
+ !assert {model: sale.order, id: so_mts3, string: wrong so line sale_flow state}:
+ - order_line[0].sale_flow == 'direct_delivery'
+-
+ I create SO for 3xMT0 Product
+-
+ !record {model: sale.order, id: so_mto2}:
+ partner_id: base.res_partner_2
+ order_line:
+ - product_id: prod_mto
+ product_uom_qty: 3
+-
+ The so line should have sale_flow set to dropshipping
+-
+ !assert {model: sale.order, id: so_mto2, string: wrong so line sale_flow state}:
+ - order_line[0].sale_flow == 'direct_delivery'
Follow ups