Merge lp:~openerp-dev/openobject-addons/7.0-opw-600945-msh into lp:openobject-addons/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Approved
Approved by: Vinay Rana (OpenERP)
Approved revision: 9603
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-600945-msh
Merge into: lp:openobject-addons/7.0
Diff against target: 43 lines (+13/-2)
2 files modified
account/account_invoice.py (+11/-0)
account/account_invoice_view.xml (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-600945-msh
Reviewer Review Type Date Requested Status
Vinay Rana (OpenERP) (community) Approve
Martin Trigaux (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+195902@code.launchpad.net

Description of the change

Hello,

Fixed the issue of due_date in invoice not came according to invoice_date when invoice_date set after selecting partner, if there is already a invoice_date avaialable then onchange_partner_id returns due_date according to invoice_date + payment term days but if partner is selected and then invoice_date changed then due_date not calculated according to invoice_date.

Demo: Go to Customer/Supplier Invoice, select a partner which has payment term set, after selecting partner you will see due date is calculated according to partner's payment term but after that change the Invoice Date, Due Date doesn't changed, select Invoice Date first and then select partner which has payment term set, you will get Due Date with respect of Invoice Date.

on_change_invoice_date method should be there which is called when invoice date changed.

Thanks.

To post a comment you must log in.
9603. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]]Account: Re-fixed the issue of due_date in invoice not came according to invoice_date when invoice_date set after selecting partner, if there is already a invoice_date avaialable then onchange_partner_id returns due_date according to invoice_date + payment term days but if partner is selected and then invoice_date changed then due_date not calculated according to invoice_date.

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) :
review: Approve

Unmerged revisions

9603. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]]Account: Re-fixed the issue of due_date in invoice not came according to invoice_date when invoice_date set after selecting partner, if there is already a invoice_date avaialable then onchange_partner_id returns due_date according to invoice_date + payment term days but if partner is selected and then invoice_date changed then due_date not calculated according to invoice_date.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2013-09-20 09:50:26 +0000
3+++ account/account_invoice.py 2013-11-20 05:33:24 +0000
4@@ -558,6 +558,17 @@
5 }
6 return result
7
8+ def onchange_date_invoice(self, cr, uid, ids, type, partner_id, date_invoice):
9+ if not partner_id:
10+ return {'value': {}}
11+ p = self.pool.get('res.partner').browse(cr, uid, partner_id)
12+ if type in ('out_invoice', 'out_refund'):
13+ partner_payment_term = p.property_payment_term and p.property_payment_term.id or False
14+ else:
15+ partner_payment_term = p.property_supplier_payment_term and p.property_supplier_payment_term.id or False
16+ return self.onchange_payment_term_date_invoice(
17+ cr, uid, ids, partner_payment_term, date_invoice)
18+
19 def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice):
20 res = {}
21 if isinstance(ids, (int, long)):
22
23=== modified file 'account/account_invoice_view.xml'
24--- account/account_invoice_view.xml 2013-09-20 09:50:26 +0000
25+++ account/account_invoice_view.xml 2013-11-20 05:33:24 +0000
26@@ -177,7 +177,7 @@
27 </div>
28 </group>
29 <group>
30- <field name="date_invoice"/>
31+ <field name="date_invoice" on_change="onchange_date_invoice(type, partner_id, date_invoice)"/>
32 <field name="date_due"/>
33 <field domain="[('company_id', '=', company_id), ('type', '=', 'payable')]"
34 name="account_id" groups="account.group_account_user"/>
35@@ -326,7 +326,7 @@
36 <field name="fiscal_position" widget="selection" />
37 </group>
38 <group>
39- <field name="date_invoice"/>
40+ <field name="date_invoice" on_change="onchange_date_invoice(type, partner_id, date_invoice)" />
41 <field name="journal_id" groups="account.group_account_user"
42 on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
43 <field domain="[('company_id', '=', company_id),('type','=', 'receivable')]"