Merge lp:~openerp-dev/openobject-addons/trunk-simplify_picking_invoice-sgo into lp:openobject-addons

Proposed by Sanjay Gohel (Open ERP)
Status: Merged
Merged at revision: 6764
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-simplify_picking_invoice-sgo
Merge into: lp:openobject-addons
Diff against target: 142 lines (+13/-69)
6 files modified
sale/__openerp__.py (+0/-1)
sale/sale.py (+10/-11)
sale/sale_demo.xml (+1/-1)
sale/sale_view.xml (+1/-1)
sale/sale_workflow.xml (+1/-1)
sale/test/postpaid_order_policy.yml (+0/-54)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-simplify_picking_invoice-sgo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+96071@code.launchpad.net

Description of the change

Hello,

    I have done following works.

1. Simplify picking and invoice policy for this I have edit field order_policy rename view as a create invoice.

2. Remove one selection postpaid which is no longer use. and also remove all postpaid related code demo data and yml file.

3.Make invisible field invoice_on as it works automatically on the basis of create invoice.create invoice worked with combination of invoice_on and itself.

4. Rename invoice picking policy to ship policy for more understanding.

Thank You
sanjay Gohel
(SGO)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sale/__openerp__.py'
--- sale/__openerp__.py 2012-04-02 09:27:46 +0000
+++ sale/__openerp__.py 2012-04-27 13:37:21 +0000
@@ -92,7 +92,6 @@
92 'test/sale_order_demo.yml',92 'test/sale_order_demo.yml',
93 'test/picking_order_policy.yml',93 'test/picking_order_policy.yml',
94 'test/manual_order_policy.yml',94 'test/manual_order_policy.yml',
95 'test/postpaid_order_policy.yml',
96 'test/prepaid_order_policy.yml',95 'test/prepaid_order_policy.yml',
97 'test/cancel_order.yml',96 'test/cancel_order.yml',
98 'test/delete_order.yml',97 'test/delete_order.yml',
9998
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-04-18 15:00:26 +0000
+++ sale/sale.py 2012-04-27 13:37:21 +0000
@@ -222,18 +222,17 @@
222222
223 '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."),223 '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."),
224 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')],224 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')],
225 '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?"""),225 'Shipping Policy', required=True, readonly=True, states={'draft': [('readonly', False)]},
226 help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
226 'order_policy': fields.selection([227 'order_policy': fields.selection([
227 ('prepaid', 'Pay before delivery'),228 ('manual', 'On Demand'),
228 ('manual', 'Deliver & invoice on demand'),229 ('picking', 'On Delivery Order'),
229 ('picking', 'Invoice based on deliveries'),230 ('prepaid', 'Before Delivery'),
230 ('postpaid', 'Invoice on order after delivery'),231 ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)]},
231 ], 'Invoice Policy', required=True, readonly=True, states={'draft': [('readonly', False)]},232 help="""This field controls how invoice and delivery operations are synchronized.
232 help="""The Invoice Policy is used to synchronise invoice and delivery operations.233 - With 'On Demand', the invoice is created manually when needed.
233 - The 'Pay before delivery' choice will first generate the invoice and then generate the picking order after the payment of this invoice.234 - With 'On Delivery Order', a draft invoice is generated after all pickings have been processed.
234 - 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.235 - With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""),
235 - The 'Invoice on order after delivery' choice will generate the draft invoice based on sales order after all picking lists have been finished.
236 - The 'Invoice based on deliveries' choice is used to create an invoice during the picking process."""),
237 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist for current sales order."),236 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist for current sales order."),
238 '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."),237 '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."),
239238
240239
=== modified file 'sale/sale_demo.xml'
--- sale/sale_demo.xml 2012-03-20 05:22:58 +0000
+++ sale/sale_demo.xml 2012-04-27 13:37:21 +0000
@@ -68,7 +68,7 @@
68 <field name="partner_invoice_id" ref="base.res_partner_address_9"/>68 <field name="partner_invoice_id" ref="base.res_partner_address_9"/>
69 <field name="partner_shipping_id" ref="base.res_partner_address_9"/>69 <field name="partner_shipping_id" ref="base.res_partner_address_9"/>
70 <field name="invoice_quantity">order</field>70 <field name="invoice_quantity">order</field>
71 <field name="order_policy">postpaid</field>71 <field name="order_policy">prepaid</field>
72 72
73 </record>73 </record>
7474
7575
=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml 2012-04-25 12:12:23 +0000
+++ sale/sale_view.xml 2012-04-27 13:37:21 +0000
@@ -227,7 +227,7 @@
227 <field name="incoterm" widget="selection"/>227 <field name="incoterm" widget="selection"/>
228 <field name="picking_policy" required="True"/>228 <field name="picking_policy" required="True"/>
229 <field name="order_policy" on_change="shipping_policy_change(order_policy)"/>229 <field name="order_policy" on_change="shipping_policy_change(order_policy)"/>
230 <field name="invoice_quantity" attrs="{'readonly':[('order_policy','in',('prepaid','picking'))]}"/>230 <field name="invoice_quantity" invisible="True"/>
231 </group>231 </group>
232 <group colspan="2" col="2">232 <group colspan="2" col="2">
233 <separator string="References" colspan="2"/>233 <separator string="References" colspan="2"/>
234234
=== modified file 'sale/sale_workflow.xml'
--- sale/sale_workflow.xml 2011-12-19 16:54:40 +0000
+++ sale/sale_workflow.xml 2012-04-27 13:37:21 +0000
@@ -172,7 +172,7 @@
172 <record id="trans_wait_invoice_invoice" model="workflow.transition">172 <record id="trans_wait_invoice_invoice" model="workflow.transition">
173 <field name="act_from" ref="act_wait_invoice"/>173 <field name="act_from" ref="act_wait_invoice"/>
174 <field name="act_to" ref="act_invoice"/>174 <field name="act_to" ref="act_invoice"/>
175 <field name="condition">(order_policy=='prepaid') or ((order_policy=='postpaid') and shipped)</field>175 <field name="condition">(order_policy=='prepaid')</field>
176 </record>176 </record>
177177
178 <record id="trans_wait_invoice_invoice_manual" model="workflow.transition">178 <record id="trans_wait_invoice_invoice_manual" model="workflow.transition">
179179
=== removed file 'sale/test/postpaid_order_policy.yml'
--- sale/test/postpaid_order_policy.yml 2011-12-19 16:54:40 +0000
+++ sale/test/postpaid_order_policy.yml 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
1-
2 Now I confirm the Quotation with "Invoice on order after delivery" policy.
3-
4 !workflow {model: sale.order, action: order_confirm, ref: order2}
5-
6 I check that related delivery order after confirmed.
7-
8 !python {model: sale.order}: |
9 sale_order = self.browse(cr, uid, ref("order2"))
10 assert sale_order.picking_ids, "Delivery Order should be created."
11 assert len(sale_order.invoice_ids) == False, "Invoice should be not created."
12-
13 Now, I dispatch delivery order.
14-
15 !python {model: stock.partial.picking}: |
16 order = self.pool.get('sale.order').browse(cr, uid, ref("order2"))
17 for pick in order.picking_ids:
18 data = pick.force_assign()
19 if data == True:
20 partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
21 self.do_partial(cr, uid, [partial_id])
22-
23 I open the invoice.
24-
25 !python {model: sale.order}: |
26 import netsvc
27 wf_service = netsvc.LocalService("workflow")
28 order = self.browse(cr, uid, ref("order2"))
29 #assert order.invoice_ids, "Invoice should be created after dispatch delivery order."
30 for invoice in order.invoice_ids:
31 wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
32-
33 I pay the invoice.
34-
35 !python {model: account.invoice}: |
36 sale_order = self.pool.get('sale.order')
37 order = sale_order.browse(cr, uid, ref("order2"))
38 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
39 for invoice in order.invoice_ids:
40 invoice.pay_and_reconcile(
41 invoice.amount_total, ref('account.cash'), ref('account.period_8'),
42 journal_ids[0], ref('account.cash'),
43 ref('account.period_8'), journal_ids[0],
44 name='test')
45-
46 I check that an order has been invoiced, shipped and closed.
47-
48 !python {model: sale.order}: |
49 order = self.browse(cr, uid, ref("order2"))
50 assert order.picked_rate == 100, "Shipment progress is not 100%."
51 #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.
52 #assert order.invoiced == True, "Sale order is not invoiced."
53 #assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
54 #assert order.state == 'done', 'Order should be in closed.'

Subscribers

People subscribed via source and target branches

to all changes: