From c7166b7fdb29ac98bc8bdffe8f3f15f8fef5134c Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 2 Mar 2012 12:17:09 +0530 Subject: [PATCH 1/7] [FIX]Sale:Simplify the picking and the invoice policy on Sale order edit order policy and set invoice on as per needed bzr revid: sgo@tinyerp.com-20120302064709-430idkcoq18t6q4x --- addons/sale/__openerp__.py | 2 +- addons/sale/sale.py | 18 ++++++++---------- addons/sale/sale_demo.xml | 8 ++++---- addons/sale/sale_view.xml | 2 +- addons/sale/sale_workflow.xml | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index ff2cfb03f5f..04a9d1a2ef6 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -91,7 +91,7 @@ Dashboard for Sales Manager that includes: 'test/sale_order_demo.yml', 'test/picking_order_policy.yml', 'test/manual_order_policy.yml', - 'test/postpaid_order_policy.yml', + #'test/postpaid_order_policy.yml', 'test/prepaid_order_policy.yml', 'test/cancel_order.yml', 'test/delete_order.yml', diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 82bfda7b580..3274781a9f7 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -223,16 +223,14 @@ class sale_order(osv.osv): 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], 'Picking Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), 'order_policy': fields.selection([ - ('prepaid', 'Pay before delivery'), - ('manual', 'Deliver & invoice on demand'), - ('picking', 'Invoice based on deliveries'), - ('postpaid', 'Invoice on order after delivery'), - ], 'Invoice Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, - help="""The Invoice Policy is used to synchronise invoice and delivery operations. - - The 'Pay before delivery' choice will first generate the invoice and then generate the picking order after the payment of this invoice. - - The 'Deliver & Invoice on demand' will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice based on the sale order or the sale order lines. - - The 'Invoice on order after delivery' choice will generate the draft invoice based on sales order after all picking lists have been finished. - - The 'Invoice based on deliveries' choice is used to create an invoice during the picking process."""), + ('prepaid', 'Before Delivery'), + ('manual', 'On Demand'), + ('picking', 'On Delivery Order'), + ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)]}, + help="""The Create Invoice is used to synchronise invoice and delivery operations. + - The 'Before Delivery' choice will first generate the invoice and then generate the picking order after the payment of this invoice. + - The 'On Demand' will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice based on the sale order or the sale order lines. + - The 'On Delivery Order' choice will generate the draft invoice based on sales order after all picking lists have been finished."""), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist for current sales order."), 'project_id': fields.many2one('account.analytic.account', 'Contract/Analytic Account', readonly=True, states={'draft': [('readonly', False)]}, help="The analytic account related to a sales order."), diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml index 5da496a1c4b..3b5c4c46b3a 100644 --- a/addons/sale/sale_demo.xml +++ b/addons/sale/sale_demo.xml @@ -61,7 +61,7 @@ - + - + diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 90d3838f5a0..e26e3d34560 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -222,7 +222,7 @@ - + diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml index 0ff5eb15ea0..78284ee1eb1 100644 --- a/addons/sale/sale_workflow.xml +++ b/addons/sale/sale_workflow.xml @@ -172,7 +172,7 @@ - (order_policy=='prepaid') or ((order_policy=='postpaid') and shipped) + (order_policy=='prepaid') From 17865d58f09d4dca1d22e4dded0f8fbbdd179284 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Mon, 5 Mar 2012 11:01:26 +0530 Subject: [PATCH 2/7] [IMP]Sale:inisible invoice_quantity sale bzr revid: sgo@tinyerp.com-20120305053126-x86etpu68px7gq89 --- addons/sale/sale_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index e26e3d34560..b2a97f78a21 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -222,7 +222,7 @@ - + From 9d3411ee548eacacae3363f5b921fe9eee1c5ee9 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Tue, 6 Mar 2012 12:03:02 +0530 Subject: [PATCH 3/7] [IMP]remove comments unused code bzr revid: sgo@tinyerp.com-20120306063302-thlryjejp9idkjq3 --- addons/sale/__openerp__.py | 1 - addons/sale/sale.py | 2 +- addons/sale/sale_demo.xml | 36 --------------- addons/sale/test/postpaid_order_policy.yml | 54 ---------------------- 4 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 addons/sale/test/postpaid_order_policy.yml diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 04a9d1a2ef6..7e0139ba749 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -91,7 +91,6 @@ Dashboard for Sales Manager that includes: 'test/sale_order_demo.yml', 'test/picking_order_policy.yml', 'test/manual_order_policy.yml', - #'test/postpaid_order_policy.yml', 'test/prepaid_order_policy.yml', 'test/cancel_order.yml', 'test/delete_order.yml', diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 3274781a9f7..198d1d57935 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -221,7 +221,7 @@ class sale_order(osv.osv): 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction."), 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], - 'Picking Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), + 'Picking Ship', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), 'order_policy': fields.selection([ ('prepaid', 'Before Delivery'), ('manual', 'On Demand'), diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml index 3b5c4c46b3a..990c76a5242 100644 --- a/addons/sale/sale_demo.xml +++ b/addons/sale/sale_demo.xml @@ -61,42 +61,6 @@ - - - - - - - - diff --git a/addons/sale/test/postpaid_order_policy.yml b/addons/sale/test/postpaid_order_policy.yml deleted file mode 100644 index eeea02e2305..00000000000 --- a/addons/sale/test/postpaid_order_policy.yml +++ /dev/null @@ -1,54 +0,0 @@ -- - Now I confirm the Quotation with "Invoice on order after delivery" policy. -- - !workflow {model: sale.order, action: order_confirm, ref: order2} -- - I check that related delivery order after confirmed. -- - !python {model: sale.order}: | - sale_order = self.browse(cr, uid, ref("order2")) - assert sale_order.picking_ids, "Delivery Order should be created." - assert len(sale_order.invoice_ids) == False, "Invoice should be not created." -- - Now, I dispatch delivery order. -- - !python {model: stock.partial.picking}: | - order = self.pool.get('sale.order').browse(cr, uid, ref("order2")) - for pick in order.picking_ids: - data = pick.force_assign() - if data == True: - partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]}) - self.do_partial(cr, uid, [partial_id]) -- - I open the invoice. -- - !python {model: sale.order}: | - import netsvc - wf_service = netsvc.LocalService("workflow") - order = self.browse(cr, uid, ref("order2")) - #assert order.invoice_ids, "Invoice should be created after dispatch delivery order." - for invoice in order.invoice_ids: - wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr) -- - I pay the invoice. -- - !python {model: account.invoice}: | - sale_order = self.pool.get('sale.order') - order = sale_order.browse(cr, uid, ref("order2")) - journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1) - for invoice in order.invoice_ids: - invoice.pay_and_reconcile( - invoice.amount_total, ref('account.cash'), ref('account.period_8'), - journal_ids[0], ref('account.cash'), - ref('account.period_8'), journal_ids[0], - name='test') -- - I check that an order has been invoiced, shipped and closed. -- - !python {model: sale.order}: | - order = self.browse(cr, uid, ref("order2")) - assert order.picked_rate == 100, "Shipment progress is not 100%." - #assert order.shipped, "Delivery Order should be dispatch." #TOFIX: procurement is gone in idle state so order never shipped, invoiced. after install mrp, it will be normal. - #assert order.invoiced == True, "Sale order is not invoiced." - #assert order.invoiced_rate == 100, "Invoiced progress is not 100%." - #assert order.state == 'done', 'Order should be in closed.' From 2cc824e2c2e6b471ae2db051d1c3134f58f79f2a Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Tue, 6 Mar 2012 12:31:06 +0530 Subject: [PATCH 4/7] [IMP]minor changes bzr revid: sgo@tinyerp.com-20120306070106-r8bm18vpqahgr865 --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 198d1d57935..53fd2227bd9 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -221,7 +221,7 @@ class sale_order(osv.osv): 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction."), 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], - 'Picking Ship', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), + 'Ship Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), 'order_policy': fields.selection([ ('prepaid', 'Before Delivery'), ('manual', 'On Demand'), From fa3f4f180f533f3f21cf072f0e48d1a64c8e3296 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 15 Mar 2012 12:03:41 +0530 Subject: [PATCH 5/7] [IMP]Add demo data record which is deleted bzr revid: sgo@tinyerp.com-20120315063341-7jsvfbttbsrvpw0v --- addons/sale/sale_demo.xml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml index 990c76a5242..64dcaf89c9c 100644 --- a/addons/sale/sale_demo.xml +++ b/addons/sale/sale_demo.xml @@ -61,6 +61,42 @@ + + + + + + + + + order + prepaid + + + + + + + + [PC2] Computer assembled on demand + + + 540 + make_to_order + + + + [MB1] Mainboard ASUStek (purchased on order) + + + 88 + 8 + 8 + make_to_order + + + + From 623965a9a7d2b817afdf95ffdd597a3681ae0506 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 23 Mar 2012 18:37:45 +0530 Subject: [PATCH 6/7] [IMP]Improve tool tip bzr revid: sgo@tinyerp.com-20120323130745-lw4i7r619e9mox5c --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 53fd2227bd9..564615ba39d 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -228,7 +228,7 @@ class sale_order(osv.osv): ('picking', 'On Delivery Order'), ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""The Create Invoice is used to synchronise invoice and delivery operations. - - The 'Before Delivery' choice will first generate the invoice and then generate the picking order after the payment of this invoice. + - The 'Before Delivery' choice will create the draft invoice and the invoice must be paid before the delivery. - The 'On Demand' will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice based on the sale order or the sale order lines. - The 'On Delivery Order' choice will generate the draft invoice based on sales order after all picking lists have been finished."""), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist for current sales order."), From 00ee3bccd29c7672a3a8ad53ac8d74be6545ab0e Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 27 Apr 2012 15:33:26 +0200 Subject: [PATCH 7/7] [IMP] sale.order: improve English in labels and tooltips bzr revid: rco@openerp.com-20120427133326-ofsz2ovqidalx4y3 --- addons/sale/sale.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 5bf624967b9..c2ee42b6fca 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -222,16 +222,17 @@ class sale_order(osv.osv): 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction."), 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], - 'Ship Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), + 'Shipping Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, + help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""), 'order_policy': fields.selection([ - ('prepaid', 'Before Delivery'), - ('manual', 'On Demand'), - ('picking', 'On Delivery Order'), - ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)]}, - help="""The Create Invoice is used to synchronise invoice and delivery operations. - - The 'Before Delivery' choice will create the draft invoice and the invoice must be paid before the delivery. - - The 'On Demand' will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice based on the sale order or the sale order lines. - - The 'On Delivery Order' choice will generate the draft invoice based on sales order after all picking lists have been finished."""), + ('manual', 'On Demand'), + ('picking', 'On Delivery Order'), + ('prepaid', 'Before Delivery'), + ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)]}, + help="""This field controls how invoice and delivery operations are synchronized. + - With 'On Demand', the invoice is created manually when needed. + - With 'On Delivery Order', a draft invoice is generated after all pickings have been processed. + - With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist for current sales order."), 'project_id': fields.many2one('account.analytic.account', 'Contract/Analytic Account', readonly=True, states={'draft': [('readonly', False)]}, help="The analytic account related to a sales order."),