Merge lp:~openerp-commiter/openobject-addons/5.0-finance_fixes into lp:openobject-addons
- 5.0-finance_fixes
- Merge into trunk
Status: | Merged | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merge reported by: | Husen Daudi | ||||||||||||||||||||||||
Merged at revision: | not available | ||||||||||||||||||||||||
Proposed branch: | lp:~openerp-commiter/openobject-addons/5.0-finance_fixes | ||||||||||||||||||||||||
Merge into: | lp:openobject-addons | ||||||||||||||||||||||||
Diff against target: |
437 lines 8 files modified
account/account.py (+1/-1) account/account_bank_statement.py (+11/-3) account/account_move_line.py (+8/-7) account/account_view.xml (+3/-0) account/invoice.py (+43/-11) account/wizard/wizard_pay_invoice.py (+42/-13) account/wizard/wizard_reconcile.py (+22/-9) account_payment/wizard/wizard_payment_order.py (+1/-0) |
||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~openerp-commiter/openobject-addons/5.0-finance_fixes | ||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Husen Daudi (community) | Approve | ||
Odoo Drivers | Pending | ||
OpenERP Core Team | Pending | ||
DragoDen | Pending | ||
Review via email:
|
Commit message
Description of the change
- 2468. By Raphaël Valyi - http://www.akretion.com
-
[FIX] account: removed pdb now that things are claimed fixed (after the commits messages)
- 2469. By Raphaël Valyi - http://www.akretion.com
-
[FIX] account: avoid translate tool missing import on strictier Python 2.6 versions; bare in mind that mx.Datetime should be eraticated from the surface of the earth
- 2470. By Raphaël Valyi - http://www.akretion.com
-
[IMP] account: make comment mandatory. Since it has a default value anyway, it doesn't reall y change anything, but makes the reconciliation UI looks consistent accross the whole OpenERP (eg invoice payment)
- 2471. By Raphaël Valyi - http://www.akretion.com
-
[MERGE]
- 2472. By Joël Grand-Guillaume @ camptocamp
-
[FIX] Correct the validate function for balanced move into account.py (after Fabien Warning)
- 2473. By Joël Grand-Guillaume @ camptocamp
-
[FIX] Merge to correct type
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : | # |
Hello !
First of all thank you for the work :) !
For the trunk merge, what do you expect from us ? You want I created another branch with things you don't commit about the bank statement things !?
Why don't you include it immediately into the trunk ?
Thanks to let me know how I ensure this will be present into the next version.
Best regards,
Joël
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Husen Daudi (husendaudi) wrote : | # |
Hello Joel,
We merge stable branch with trunk every month so your changes will be applied in trunk automatically.
For pending changes I listed out in last post, I will add It in trunk and merge your stable changes in trunk soon.
Thanks again.
HDA
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : | # |
Perfect !
Thank you for everything.
Joël
Preview Diff
1 | === modified file 'account/account.py' |
2 | --- account/account.py 2009-11-04 06:46:25 +0000 |
3 | +++ account/account.py 2009-11-04 13:46:13 +0000 |
4 | @@ -988,7 +988,7 @@ |
5 | if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id): |
6 | raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name))) |
7 | |
8 | - if abs(amount) < 0.0001: |
9 | + if abs(amount) < 10**-int(config['price_accuracy']): |
10 | if not len(line_draft_ids): |
11 | continue |
12 | self.pool.get('account.move.line').write(cr, uid, line_draft_ids, { |
13 | |
14 | === modified file 'account/account_bank_statement.py' |
15 | --- account/account_bank_statement.py 2009-10-14 11:15:34 +0000 |
16 | +++ account/account_bank_statement.py 2009-11-04 13:46:14 +0000 |
17 | @@ -170,7 +170,9 @@ |
18 | if line.state <> 'valid': |
19 | raise osv.except_osv(_('Error !'), |
20 | _('The account entries lines are not in valid state.')) |
21 | - |
22 | + # for bank.statement.lines |
23 | + # In line we get reconcile_id on bank.ste.rec. |
24 | + # in bank stat.rec we get line_new_ids on bank.stat.rec.line |
25 | for move in st.line_ids: |
26 | move_id = account_move_obj.create(cr, uid, { |
27 | 'journal_id': st.journal_id.id, |
28 | @@ -209,7 +211,7 @@ |
29 | 'period_id': st.period_id.id, |
30 | 'currency_id': st.currency.id, |
31 | } |
32 | - |
33 | + |
34 | amount = res_currency_obj.compute(cr, uid, st.currency.id, |
35 | company_currency_id, move.amount, context=context, |
36 | account=acc_cur) |
37 | @@ -245,6 +247,8 @@ |
38 | 'statement_id': st.id, |
39 | 'journal_id': st.journal_id.id, |
40 | 'period_id': st.period_id.id, |
41 | + # Add analytical account if provided.. |
42 | + 'analytic_account_id':newline.analytic_id and newline.analytic_id.id or False, |
43 | }, context=context) |
44 | |
45 | # Fill the secondary amount/currency |
46 | @@ -491,10 +495,14 @@ |
47 | _name = "account.bank.statement.reconcile.line" |
48 | _description = "Statement reconcile line" |
49 | _columns = { |
50 | - 'name': fields.char('Description', size=64), |
51 | + 'name': fields.char('Description', size=64, required=True), |
52 | 'account_id': fields.many2one('account.account', 'Account', required=True), |
53 | 'line_id': fields.many2one('account.bank.statement.reconcile', 'Reconcile'), |
54 | 'amount': fields.float('Amount', required=True), |
55 | + 'analytic_id': fields.many2one('account.analytic.account',"Analytic Account") |
56 | + } |
57 | + _defaults = { |
58 | + 'name': lambda *a: 'Write-Off', |
59 | } |
60 | account_bank_statement_reconcile_line() |
61 | |
62 | |
63 | === modified file 'account/account_move_line.py' |
64 | --- account/account_move_line.py 2009-10-29 10:16:18 +0000 |
65 | +++ account/account_move_line.py 2009-11-04 13:46:15 +0000 |
66 | @@ -351,8 +351,8 @@ |
67 | 'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."), |
68 | 'product_uom_id': fields.many2one('product.uom', 'UoM'), |
69 | 'product_id': fields.many2one('product.product', 'Product'), |
70 | - 'debit': fields.float('Debit', digits=(16,2)), |
71 | - 'credit': fields.float('Credit', digits=(16,2)), |
72 | + 'debit': fields.float('Debit', digits=(16,int(tools.config['price_accuracy']))), |
73 | + 'credit': fields.float('Credit', digits=(16,int(tools.config['price_accuracy']))), |
74 | 'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2), |
75 | 'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", states={'valid':[('readonly',True)]}, help="The move of this entry line.", select=2), |
76 | |
77 | @@ -360,7 +360,7 @@ |
78 | 'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1), |
79 | 'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2), |
80 | 'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2), |
81 | - 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry."), |
82 | + 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits=(16,int(tools.config['price_accuracy']))), |
83 | 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."), |
84 | |
85 | 'period_id': fields.many2one('account.period', 'Period', required=True, select=2), |
86 | @@ -379,14 +379,14 @@ |
87 | 'balance': fields.function(_balance, fnct_search=_balance_search, method=True, string='Balance'), |
88 | 'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'Status', readonly=True), |
89 | 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or tax code account."), |
90 | - 'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True, help="If the Tax account is tax code account, this field will contain the taxed amount.If the tax account is base tax code,\ |
91 | + 'tax_amount': fields.float('Tax/Base Amount', digits=(16,int(tools.config['price_accuracy'])), select=True, help="If the Tax account is tax code account, this field will contain the taxed amount.If the tax account is base tax code,\ |
92 | this field will contain the basic amount(without tax)."), |
93 | 'invoice': fields.function(_invoice, method=True, string='Invoice', |
94 | type='many2one', relation='account.invoice', fnct_search=_invoice_search), |
95 | 'account_tax_id':fields.many2one('account.tax', 'Tax'), |
96 | 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account'), |
97 | #TODO: remove this |
98 | - 'amount_taxed':fields.float("Taxed Amount",digits=(16,2)), |
99 | + 'amount_taxed':fields.float("Taxed Amount",digits=(16,int(tools.config['price_accuracy']))), |
100 | |
101 | } |
102 | |
103 | @@ -626,6 +626,7 @@ |
104 | 'debit':debit, |
105 | 'credit':credit, |
106 | 'account_id':writeoff_acc_id, |
107 | + 'analytic_account_id': context.get('analytic_id', False), |
108 | 'date':date, |
109 | 'partner_id':partner_id |
110 | }) |
111 | @@ -634,7 +635,7 @@ |
112 | writeoff_move_id = self.pool.get('account.move').create(cr, uid, { |
113 | 'period_id': writeoff_period_id, |
114 | 'journal_id': writeoff_journal_id, |
115 | - |
116 | + 'date':date, |
117 | 'state': 'draft', |
118 | 'line_id': writeoff_lines |
119 | }) |
120 | @@ -879,7 +880,7 @@ |
121 | 'amount': vals['debit'] or vals['credit'], |
122 | 'general_account_id': vals['account_id'], |
123 | 'journal_id': journal.analytic_journal_id.id, |
124 | - 'ref': vals['ref'], |
125 | + 'ref': vals.get('ref', False), |
126 | })] |
127 | #else: |
128 | # raise osv.except_osv(_('No analytic journal !'), _('Please set an analytic journal on this financial journal !')) |
129 | |
130 | === modified file 'account/account_view.xml' |
131 | --- account/account_view.xml 2009-10-29 10:16:18 +0000 |
132 | +++ account/account_view.xml 2009-11-04 13:46:15 +0000 |
133 | @@ -336,6 +336,7 @@ |
134 | <field name="date"/> |
135 | <field name="ref"/> |
136 | <field name="name"/> |
137 | + <field name="account_id"/> |
138 | <field name="type"/> |
139 | <field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/> |
140 | <field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/> |
141 | @@ -346,6 +347,7 @@ |
142 | <form string="Statement lines"> |
143 | <field name="date"/> |
144 | <field name="name"/> |
145 | + <field name="account_id"/> |
146 | <field name="type"/> |
147 | <field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/> |
148 | <field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id"/> |
149 | @@ -418,6 +420,7 @@ |
150 | <tree editable="bottom" string="Write-Off"> |
151 | <field name="account_id" domain="[('type','<>','view'),('type','<>','consolidation')]"/> |
152 | <field name="amount"/> |
153 | + <field name="analytic_id" domain="[('type','<>','view')]"/> |
154 | <field name="name"/> |
155 | </tree> |
156 | </field> |
157 | |
158 | === modified file 'account/invoice.py' |
159 | --- account/invoice.py 2009-11-04 06:46:25 +0000 |
160 | +++ account/invoice.py 2009-11-04 13:46:15 +0000 |
161 | @@ -105,23 +105,41 @@ |
162 | cur_obj = self.pool.get('res.currency') |
163 | for inv in data_inv: |
164 | debit = credit = 0.0 |
165 | + context.update({'date':inv.date_invoice}) |
166 | + context_unreconciled=context.copy() |
167 | for lines in inv.move_lines: |
168 | - if lines.account_id.company_currency_id.id <> inv.currency_id.id: |
169 | - if lines.debit: |
170 | - debit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.debit) |
171 | - if lines.credit: |
172 | - credit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.credit) |
173 | + debit_tmp = lines.debit |
174 | + credit_tmp = lines.credit |
175 | + # If currency conversion needed |
176 | + if inv.company_id.currency_id.id <> inv.currency_id.id: |
177 | + # If invoice paid, compute currency amount according to invoice date |
178 | + # otherwise, take the line date |
179 | + if not inv.reconciled: |
180 | + context.update({'date':lines.date}) |
181 | + context_unreconciled.update({'date':lines.date}) |
182 | + # If amount currency setted, compute for debit and credit in company currency |
183 | + if lines.amount_currency < 0: |
184 | + credit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False,context=context_unreconciled)) |
185 | + elif lines.amount_currency > 0: |
186 | + debit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False,context=context_unreconciled)) |
187 | + # Then, recomput into invoice currency to avoid rounding trouble ! |
188 | + debit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, debit_tmp, round=False,context=context) |
189 | + credit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, credit_tmp, round=False,context=context) |
190 | else: |
191 | - debit += lines.debit |
192 | - credit += lines.credit |
193 | - |
194 | + debit+=debit_tmp |
195 | + credit+=credit_tmp |
196 | + |
197 | if not inv.amount_total: |
198 | result = 0.0 |
199 | elif inv.type in ('out_invoice','in_refund'): |
200 | - result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total)) |
201 | + amount = credit-debit |
202 | + result = inv.amount_total - amount |
203 | else: |
204 | - result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total)) |
205 | - res[inv.id] = round(result,int(config['price_accuracy'])) |
206 | + amount = debit-credit |
207 | + result = inv.amount_total - amount |
208 | + # Use is_zero function to avoid rounding trouble => should be fixed into ORM |
209 | + res[inv.id] = not self.pool.get('res.currency').is_zero(cr, uid, inv.company_id.currency_id,result) and result or 0.0 |
210 | + |
211 | return res |
212 | |
213 | def _get_lines(self, cr, uid, ids, name, arg, context=None): |
214 | @@ -871,6 +889,16 @@ |
215 | date=context['date_p'] |
216 | else: |
217 | date=time.strftime('%Y-%m-%d') |
218 | + |
219 | + # Take the amount in currency and the currency of the payment |
220 | + if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: |
221 | + amount_currency = context['amount_currency'] |
222 | + currency_id = context['currency_id'] |
223 | + else: |
224 | + amount_currency = False |
225 | + currency_id = False |
226 | + |
227 | + # Pay attention to the sign for both debit/credit AND amount_currency |
228 | l1 = { |
229 | 'debit': direction * pay_amount>0 and direction * pay_amount, |
230 | 'credit': direction * pay_amount<0 and - direction * pay_amount, |
231 | @@ -878,6 +906,8 @@ |
232 | 'partner_id': invoice.partner_id.id, |
233 | 'ref':invoice.number, |
234 | 'date': date, |
235 | + 'currency_id':currency_id, |
236 | + 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
237 | } |
238 | l2 = { |
239 | 'debit': direction * pay_amount<0 and - direction * pay_amount, |
240 | @@ -886,6 +916,8 @@ |
241 | 'partner_id': invoice.partner_id.id, |
242 | 'ref':invoice.number, |
243 | 'date': date, |
244 | + 'currency_id':currency_id, |
245 | + 'amount_currency':amount_currency and - direction * amount_currency or 0.0, |
246 | } |
247 | |
248 | if not name: |
249 | |
250 | === modified file 'account/wizard/wizard_pay_invoice.py' |
251 | --- account/wizard/wizard_pay_invoice.py 2009-10-14 11:15:34 +0000 |
252 | +++ account/wizard/wizard_pay_invoice.py 2009-11-04 13:46:15 +0000 |
253 | @@ -24,6 +24,7 @@ |
254 | import pooler |
255 | import time |
256 | from tools.translate import _ |
257 | +import tools |
258 | |
259 | pay_form = '''<?xml version="1.0"?> |
260 | <form string="Pay invoice"> |
261 | @@ -36,7 +37,7 @@ |
262 | </form>''' |
263 | |
264 | pay_fields = { |
265 | - 'amount': {'string': 'Amount paid', 'type':'float', 'required':True}, |
266 | + 'amount': {'string': 'Amount paid', 'type':'float', 'required':True, 'digits': (16,int(tools.config['price_accuracy']))}, |
267 | 'name': {'string': 'Entry Name', 'type':'char', 'size': 64, 'required':True}, |
268 | 'date': {'string': 'Payment date', 'type':'date', 'required':True, 'default':lambda *args: time.strftime('%Y-%m-%d')}, |
269 | 'journal_id': {'string': 'Journal/Payment Mode', 'type': 'many2one', 'relation':'account.journal', 'required':True, 'domain':[('type','=','cash')]}, |
270 | @@ -52,18 +53,24 @@ |
271 | pool = pooler.get_pool(cr.dbname) |
272 | cur_obj = pool.get('res.currency') |
273 | amount = form['amount'] |
274 | + context['analytic_id'] = form.get('analytic_id', False) |
275 | |
276 | invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context) |
277 | journal = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context) |
278 | + # Compute the amount in company's currency, with the journal currency (which is equal to payment currency) |
279 | + # when it is needed : If payment currency (according to selected journal.currency) is <> from company currency |
280 | if journal.currency and invoice.company_id.currency_id.id<>journal.currency.id: |
281 | ctx = {'date':data['form']['date']} |
282 | amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, amount, context=ctx) |
283 | - |
284 | + currency_id = journal.currency.id |
285 | + # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency |
286 | + context.update({'amount_currency':form['amount'],'currency_id':currency_id}) |
287 | + |
288 | # Take the choosen date |
289 | if form.has_key('comment'): |
290 | - context={'date_p':form['date'],'comment':form['comment']} |
291 | + context.update({'date_p':form['date'],'comment':form['comment']}) |
292 | else: |
293 | - context={'date_p':form['date'],'comment':False} |
294 | + context.update({'date_p':form['date'],'comment':False}) |
295 | |
296 | acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id |
297 | if not acc_id: |
298 | @@ -77,31 +84,53 @@ |
299 | pool = pooler.get_pool(cr.dbname) |
300 | invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context) |
301 | journal = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context) |
302 | - if invoice.company_id.currency_id.id <> invoice.currency_id.id: |
303 | - return 'addendum' |
304 | - if journal.currency and (journal.currency.id <> invoice.currency_id.id): |
305 | - return 'addendum' |
306 | - if pool.get('res.currency').is_zero(cr, uid, invoice.currency_id, |
307 | - (data['form']['amount'] - invoice.amount_total)): |
308 | + cur_obj = pool.get('res.currency') |
309 | + # Here we need that: |
310 | + # The invoice total amount in company's currency <> paid amount in company currency |
311 | + # (according to the correct day rate, invoicing rate and payment rate are may be different) |
312 | + # => Ask to a write-off of the difference. This could happen even if both amount are equal, |
313 | + # because if the currency rate |
314 | + # Get the amount in company currency for the invoice (according to move lines) |
315 | + inv_amount_company_currency=invoice.move_id.amount |
316 | + # Get the current amount paid in company currency |
317 | + if journal.currency and invoice.company_id.currency_id.id<>journal.currency.id: |
318 | + ctx = {'date':data['form']['date']} |
319 | + amount_paid = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, data['form']['amount'], round=True, context=ctx) |
320 | + else: |
321 | + amount_paid = data['form']['amount'] |
322 | + # Get the old payment if there are some |
323 | + if invoice.payment_ids: |
324 | + debit=credit=0.0 |
325 | + for payment in invoice.payment_ids: |
326 | + debit+=payment.debit |
327 | + credit+=payment.credit |
328 | + amount_paid+=abs(debit-credit) |
329 | + |
330 | + # Test if there is a difference according to currency rouding setting |
331 | + if pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id, |
332 | + (amount_paid - inv_amount_company_currency)): |
333 | return 'reconcile' |
334 | return 'addendum' |
335 | |
336 | _transaction_add_form = '''<?xml version="1.0"?> |
337 | <form string="Information addendum"> |
338 | <separator string="Write-Off Move" colspan="4"/> |
339 | + <field name="writeoff_journal_id"/> |
340 | <field name="writeoff_acc_id" domain="[('type','<>','view'),('type','<>','consolidation')]"/> |
341 | - <field name="writeoff_journal_id"/> |
342 | <field name="comment"/> |
343 | + <separator string="Analytic" colspan="4"/> |
344 | + <field name="analytic_id"/> |
345 | </form>''' |
346 | |
347 | _transaction_add_fields = { |
348 | 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True}, |
349 | 'writeoff_journal_id': {'string': 'Write-Off journal', 'type': 'many2one', 'relation':'account.journal', 'required':True}, |
350 | - 'comment': {'string': 'Entry Name', 'type':'char', 'size': 64, 'required':True}, |
351 | + 'comment': {'string': 'Comment', 'type':'char', 'size': 64 , 'required':True}, |
352 | + 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'}, |
353 | } |
354 | |
355 | def _get_value_addendum(self, cr, uid, data, context={}): |
356 | - return {} |
357 | + return {'comment': _('Write-Off')} |
358 | |
359 | def _get_period(self, cr, uid, data, context={}): |
360 | pool = pooler.get_pool(cr.dbname) |
361 | |
362 | === modified file 'account/wizard/wizard_reconcile.py' |
363 | --- account/wizard/wizard_reconcile.py 2009-10-14 11:15:34 +0000 |
364 | +++ account/wizard/wizard_reconcile.py 2009-11-04 13:46:16 +0000 |
365 | @@ -24,6 +24,8 @@ |
366 | import time |
367 | import osv |
368 | import pooler |
369 | +from datetime import datetime |
370 | +from tools.translate import _ |
371 | |
372 | _transaction_form = '''<?xml version="1.0"?> |
373 | <form string="Reconciliation"> |
374 | @@ -69,8 +71,18 @@ |
375 | |
376 | form = data['form'] |
377 | account_id = form.get('writeoff_acc_id', False) |
378 | - period_id = form.get('period_id', False) |
379 | + context['date_p'] = form.get('date_p', False) |
380 | + date = False |
381 | + if context['date_p']: |
382 | + date = datetime.strptime(context['date_p'], '%Y-%m-%d') |
383 | + ids = pool.get('account.period').find(cr, uid, dt=date, context=context) |
384 | + period_id = False |
385 | + if len(ids): |
386 | + period_id = ids[0] |
387 | + |
388 | journal_id = form.get('journal_id', False) |
389 | + context['comment'] = form.get('comment', False) |
390 | + context['analytic_id'] = form.get('analytic_id', False) |
391 | account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id, |
392 | period_id, journal_id, context=context) |
393 | return {} |
394 | @@ -84,23 +96,24 @@ |
395 | <form string="Information addendum"> |
396 | <separator string="Write-Off Move" colspan="4"/> |
397 | <field name="journal_id"/> |
398 | - <field name="period_id"/> |
399 | <field name="writeoff_acc_id" domain="[('type', '<>', 'view')]"/> |
400 | + <field name="date_p"/> |
401 | + <field name="comment"/> |
402 | + <separator string="Analytic" colspan="4"/> |
403 | + <field name="analytic_id"/> |
404 | </form>''' |
405 | |
406 | _transaction_add_fields = { |
407 | 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True}, |
408 | - 'period_id': {'string': 'Write-Off Period', 'type': 'many2one', 'relation':'account.period', 'required':True}, |
409 | 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True}, |
410 | + 'date_p': {'string':'Date','type':'date'}, |
411 | + 'comment': {'string':'Comment','type':'char', 'size': 64, 'required':True}, |
412 | + 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'}, |
413 | } |
414 | |
415 | def _trans_rec_addendum(self, cr, uid, data, context={}): |
416 | - pool = pooler.get_pool(cr.dbname) |
417 | - ids = pool.get('account.period').find(cr, uid, context=context) |
418 | - period_id = False |
419 | - if len(ids): |
420 | - period_id = ids[0] |
421 | - return {'period_id':period_id} |
422 | + date_p = time.strftime('%Y-%m-%d') |
423 | + return {'date_p':date_p, 'comment': _('Write-Off')} |
424 | |
425 | |
426 | class wiz_reconcile(wizard.interface): |
427 | |
428 | === modified file 'account_payment/wizard/wizard_payment_order.py' |
429 | --- account_payment/wizard/wizard_payment_order.py 2009-10-14 11:15:34 +0000 |
430 | +++ account_payment/wizard/wizard_payment_order.py 2009-11-04 13:46:16 +0000 |
431 | @@ -95,6 +95,7 @@ |
432 | 'partner_id': line.partner_id and line.partner_id.id or False, |
433 | 'communication': line.ref or '/', |
434 | 'date': date_to_pay, |
435 | + 'currency': line.invoice and line.invoice.currency_id.id or False, |
436 | }, context=context) |
437 | return {} |
438 |
Hello Joel and Raphaël Valyi,
Branch has been merged to stable addons. (16,int( tools.config[ 'price_ accuracy' ])) in account_ move_line. py. bank.statement. reconcile. line.
changes related to database attribute and field changes are not merged yet because we cannot accept api and db change in stable.
Please propose merge in trunk for that.
Functionality that is not merged are.
float field changes digits=
analytic_id field in account.
Thanks for contribution.
HDA