diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index 8a2686cca83..c121739166a 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -92,7 +92,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 9caaa86878c..c2ee42b6fca 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -222,18 +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')],
- '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?"""),
+ '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', '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."""),
+ ('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."),
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index 423ac3b9343..3d8bbae9ad7 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -68,7 +68,7 @@
order
- postpaid
+ prepaid
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 278f21cafc2..847e2e8f463 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -227,7 +227,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')
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.'