Merge lp:~unifield-team/unifield-addons/UF_1089_addons into lp:unifield-addons

Proposed by jftempo
Status: Merged
Merged at revision: 4543
Proposed branch: lp:~unifield-team/unifield-addons/UF_1089_addons
Merge into: lp:unifield-addons
Diff against target: 148 lines (+30/-2)
7 files modified
account/test/account_bank_statement.yml (+1/-0)
account/test/account_cash_statement.yml (+1/-0)
account/test/account_supplier_invoice.yml (+3/-1)
account/wizard/account_use_model.py (+7/-0)
account_voucher/account_voucher.py (+9/-0)
purchase/purchase_unit_test.xml (+1/-1)
stock/stock.py (+8/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-addons/UF_1089_addons
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+113767@code.launchpad.net
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
1=== modified file 'account/test/account_bank_statement.yml'
2--- account/test/account_bank_statement.yml 2011-08-26 13:55:35 +0000
3+++ account/test/account_bank_statement.yml 2012-07-06 16:21:25 +0000
4@@ -14,6 +14,7 @@
5 - account_id: account.a_recv
6 amount: 1000.0
7 date: !eval time.strftime('%Y-%m-%d')
8+ document_date: !eval time.strftime('%Y-%m-%d')
9 name: a
10 partner_id: base.res_partner_4
11 sequence: 0.0
12
13=== modified file 'account/test/account_cash_statement.yml'
14--- account/test/account_cash_statement.yml 2011-08-26 13:55:35 +0000
15+++ account/test/account_cash_statement.yml 2012-07-06 16:21:25 +0000
16@@ -42,6 +42,7 @@
17 - account_id: account.a_recv
18 amount: 1000.0
19 date: !eval time.strftime('%Y-%m-%d')
20+ document_date: !eval time.strftime('%Y-%m-%d')
21 name: test
22 partner_id: base.res_partner_4
23 sequence: 0.0
24
25=== modified file 'account/test/account_supplier_invoice.yml'
26--- account/test/account_supplier_invoice.yml 2011-01-14 00:11:01 +0000
27+++ account/test/account_supplier_invoice.yml 2012-07-06 16:21:25 +0000
28@@ -19,6 +19,8 @@
29 partner_id: base.res_partner_desertic_hispafuentes
30 reference_type: none
31 type: in_invoice
32+ from_yml_test: True
33+ document_date: !eval time.strftime('%Y-%m-%d')
34 -
35 I check that Initially supplier invoice state is "Draft"
36 -
37@@ -32,4 +34,4 @@
38 I check that the invoice state is now "Open"
39 -
40 !assert {model: account.invoice, id: account_invoice_supplier0}:
41- - state == 'open'
42\ No newline at end of file
43+ - state == 'open'
44
45=== modified file 'account/wizard/account_use_model.py'
46--- account/wizard/account_use_model.py 2011-01-14 00:11:01 +0000
47+++ account/wizard/account_use_model.py 2012-07-06 16:21:25 +0000
48@@ -45,6 +45,12 @@
49 "\nPlease define partner on it!")%line.name)
50 pass
51
52+ def __hook_val_update_before_line_creation(self, cr, uid, val, context=None):
53+ """
54+ Hook for change new lines values
55+ """
56+ return val
57+
58 def create_entries(self, cr, uid, ids, context=None):
59 account_model_obj = self.pool.get('account.model')
60 account_period_obj = self.pool.get('account.period')
61@@ -107,6 +113,7 @@
62 })
63 c = context.copy()
64 c.update({'journal_id': model.journal_id.id,'period_id': period_id})
65+ val = self.__hook_val_update_before_line_creation(cr, uid, val, c)
66 id_line = account_move_line_obj.create(cr, uid, val, context=c)
67
68 context.update({'move_ids':move_ids})
69
70=== modified file 'account_voucher/account_voucher.py'
71--- account_voucher/account_voucher.py 2011-07-26 11:27:59 +0000
72+++ account_voucher/account_voucher.py 2012-07-06 16:21:25 +0000
73@@ -621,6 +621,12 @@
74 res['account_id'] = account_id
75 return {'value':res}
76
77+ def __hook_move_line_values_before_creation(self, cr, uid, move_line):
78+ """
79+ Change move line vals before its creation
80+ """
81+ return move_line
82+
83 def action_move_line_create(self, cr, uid, ids, context=None):
84
85 def _get_payment_term_lines(term_id, amount):
86@@ -696,6 +702,7 @@
87 'date': inv.date,
88 'date_maturity': inv.date_due
89 }
90+ move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
91 move_line_pool.create(cr, uid, move_line)
92 rec_list_ids = []
93 line_total = debit - credit
94@@ -751,6 +758,7 @@
95 raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
96 sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1
97 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0
98+ move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
99 voucher_line = move_line_pool.create(cr, uid, move_line)
100 if line.move_line_id.id:
101 rec_ids = [voucher_line, line.move_line_id.id]
102@@ -777,6 +785,7 @@
103 #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
104 #'currency_id': company_currency <> current_currency and current_currency or False,
105 }
106+ move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
107 move_line_pool.create(cr, uid, move_line)
108 self.write(cr, uid, [inv.id], {
109 'move_id': move_id,
110
111=== modified file 'purchase/purchase_unit_test.xml'
112--- purchase/purchase_unit_test.xml 2012-01-13 10:20:41 +0000
113+++ purchase/purchase_unit_test.xml 2012-07-06 16:21:25 +0000
114@@ -52,7 +52,7 @@
115 <!-- Disallow analytic distribution verification -->
116 <function model="account.invoice" name="write">
117 <value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_ids[0].id]" />
118- <value eval="{'from_yml_test': True}"/>
119+ <value eval="{'from_yml_test': True, 'document_date': time.strftime('%Y-%m-%d')}"/>
120 </function>
121
122 <workflow model="account.invoice" action="invoice_open">
123
124=== modified file 'stock/stock.py'
125--- stock/stock.py 2012-06-06 14:50:06 +0000
126+++ stock/stock.py 2012-07-06 16:21:25 +0000
127@@ -1000,6 +1000,12 @@
128 inv_type = 'out_invoice'
129 return inv_type
130
131+ def _hook_invoice_vals_before_invoice_creation(self, cr, uid, ids, invoice_vals, picking):
132+ """
133+ Hook to permit to change invoice values before its creation
134+ """
135+ return invoice_vals
136+
137 def action_invoice_create(self, cr, uid, ids, journal_id=False,
138 group=False, type='out_invoice', context=None):
139 """ Creates invoice based on the invoice state selected for picking.
140@@ -1072,6 +1078,8 @@
141 invoice_vals['currency_id'] = cur_id
142 if journal_id:
143 invoice_vals['journal_id'] = journal_id
144+ # Add hook to changes values before creation
145+ invoice_vals = self._hook_invoice_vals_before_invoice_creation(cr, uid, ids, invoice_vals, picking)
146 invoice_id = invoice_obj.create(cr, uid, invoice_vals,
147 context=context)
148 invoices_group[partner.id] = invoice_id

Subscribers

People subscribed via source and target branches

to all changes: