Merge lp:~unifield-team/unifield-wm/utp-594 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/utp-594
Merge into: lp:unifield-wm
Diff against target: 84 lines (+21/-2)
3 files modified
account_override/invoice.py (+7/-1)
analytic_distribution/invoice.py (+12/-1)
msf_chart_of_account/data/journal_data.xml (+2/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/utp-594
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+236334@code.launchpad.net
To post a comment you must log in.
2233. By Olivier DOSSMANN

UTP-594 [FIX] Missing comma in the code

2234. By Olivier DOSSMANN

UTP-594 [FIX] Bug from UTP-1044 about a missing value in journal's data

2235. By Olivier DOSSMANN

UTP-594 [FIX] Problems to make a refund

2236. By Olivier DOSSMANN

UTP-594 [FIX] Ajout de la référence aux Journal Items depuis une refund

2237. By Olivier DOSSMANN

UTP-594 [MERGE] Last unifield trunk

Unmerged revisions

2237. By Olivier DOSSMANN

UTP-594 [MERGE] Last unifield trunk

2236. By Olivier DOSSMANN

UTP-594 [FIX] Ajout de la référence aux Journal Items depuis une refund

2235. By Olivier DOSSMANN

UTP-594 [FIX] Problems to make a refund

2234. By Olivier DOSSMANN

UTP-594 [FIX] Bug from UTP-1044 about a missing value in journal's data

2233. By Olivier DOSSMANN

UTP-594 [FIX] Missing comma in the code

2232. By Olivier DOSSMANN

UTP-594 [ADD] Link to the previous invoice when we are in a refund

2231. By Olivier DOSSMANN

UTP-594 [ADD] New link to the original invoice from which this refund comes from

2230. By Vincent GREINER

[IMP] invoice refund: hook when validate a refund

2228. By jftempo

UTP-1209 [FIX] Unable to save an AD on PO/FO

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_override/invoice.py'
2--- account_override/invoice.py 2014-09-05 08:12:52 +0000
3+++ account_override/invoice.py 2014-09-30 15:29:14 +0000
4@@ -217,6 +217,7 @@
5 states={'draft':[('readonly',False)]}),
6 'register_posting_date': fields.date(string="Register posting date for Direct Invoice", required=False),
7 'vat_ok': fields.function(_get_vat_ok, method=True, type='boolean', string='VAT OK', store=False, readonly=True),
8+ 'refund_source_inv_id': fields.many2one('account.invoice', 'Source invoice of the refund', readonly=True, invisible=True, help="Link to the invoice from which this one exists. The original one have generated this one via a refund wizard/button."),
9 }
10
11 _defaults = {
12@@ -744,7 +745,10 @@
13 if not context:
14 context = {}
15 res = super(account_invoice, self).line_get_convert(cr, uid, x, part, date, context)
16- res.update({'invoice_line_id': x.get('invoice_line_id', False)})
17+ res.update({
18+ 'invoice_line_id': x.get('invoice_line_id', False),
19+ 'reference': x.get('reference', False),
20+ })
21 return res
22
23 def finalize_invoice_move_lines(self, cr, uid, inv, line):
24@@ -765,6 +769,8 @@
25 for el in line:
26 if el[2]:
27 el[2].update({'document_date': inv.document_date})
28+ if inv.refund_source_inv_id:
29+ el[2].update({'reference': inv.origin})
30 if el[2] and is_partner_line(el[2]):
31 el[2].update({'invoice_partner_link': inv.id})
32 new_line.append((el[0], el[1], el[2]))
33
34=== modified file 'analytic_distribution/invoice.py'
35--- analytic_distribution/invoice.py 2014-05-09 12:41:01 +0000
36+++ analytic_distribution/invoice.py 2014-09-30 15:29:14 +0000
37@@ -143,15 +143,26 @@
38 """
39 Reverse lines for given invoice
40 """
41+ # Prepare some values
42 if isinstance(ids, (int, long)):
43 ids = [ids]
44+ new_ids = []
45+ # Process source invoices
46 for inv in self.browse(cr, uid, ids):
47 # Check for dates (refund must be done after invoice)
48 if date and date < inv.date_invoice:
49 raise osv.except_osv(_('Error'), _("Posting date for the refund is before the invoice's posting date!"))
50 if document_date and document_date < inv.document_date:
51 raise osv.except_osv(_('Error'), _("Document date for the refund is before the invoice's document date!"))
52- new_ids = super(account_invoice, self).refund(cr, uid, ids, date, period_id, description, journal_id)
53+ new_id = super(account_invoice, self).refund(cr, uid, [inv.id], date, period_id, description, journal_id)
54+ # UTP-594: Add Source Document on new invoice (origin field) and a link to the original invoice
55+ if isinstance(new_id, (int, long)):
56+ new_id = [new_id]
57+ self.write(cr, uid, new_id, {
58+ 'origin': inv.number,
59+ 'refund_source_inv_id': inv.id,
60+ })
61+ new_ids += new_id
62 # add document date
63 if document_date:
64 self.write(cr, uid, new_ids, {'document_date': document_date})
65
66=== modified file 'msf_chart_of_account/data/journal_data.xml'
67--- msf_chart_of_account/data/journal_data.xml 2013-12-16 16:30:03 +0000
68+++ msf_chart_of_account/data/journal_data.xml 2014-09-30 15:29:14 +0000
69@@ -166,6 +166,7 @@
70 <field name="default_debit_account_id" ref="msf_chart_of_account.3001" />
71 <field name="default_credit_account_id" ref="msf_chart_of_account.3001" />
72 <field name="analytic_journal_id" ref="cheque_analytic_journal"/>
73+ <field name="bank_journal_id" ref="bank_chf_journal"/>
74 </record>
75
76 <record id="cheque_euro_journal" model="account.journal">
77@@ -176,6 +177,7 @@
78 <field name="default_debit_account_id" ref="msf_chart_of_account.3001" />
79 <field name="default_credit_account_id" ref="msf_chart_of_account.3001" />
80 <field name="analytic_journal_id" ref="cheque_analytic_journal"/>
81+ <field name="bank_journal_id" ref="bank_euro_journal"/>
82 </record>
83
84 <record id="account_journal.engagement_journal" model="account.analytic.journal">

Subscribers

People subscribed via source and target branches