Merge lp:~openbig/bigconsulting/milestone_changes into lp:bigconsulting
- milestone_changes
- Merge into addons
Proposed by
gpa(OpenERP)
Status: | Merged |
---|---|
Merged at revision: | 36 |
Proposed branch: | lp:~openbig/bigconsulting/milestone_changes |
Merge into: | lp:bigconsulting |
Diff against target: |
535 lines (+273/-71) (has conflicts) 8 files modified
account_invoice_cash_discount/__init__.py (+2/-1) account_invoice_cash_discount/__terp__.py (+4/-0) account_invoice_cash_discount/account_invoice_cash_discount.py (+94/-50) account_invoice_cash_discount/account_invoice_cash_discount_view.xml (+40/-0) account_invoice_cash_discount/wizard/__init__.py (+1/-0) account_invoice_cash_discount/wizard/account_pay_invoice.py (+115/-16) account_invoice_cash_discount/wizard/account_pay_invoice_view.xml (+15/-2) packing_barcode_check/report/bar_code_check.rml (+2/-2) Text conflict in account_invoice_cash_discount/__terp__.py |
To merge this branch: | bzr merge lp:~openbig/bigconsulting/milestone_changes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
openbig | Pending | ||
Review via email: mp+28748@code.launchpad.net |
Commit message
Description of the change
Added changes as milestone1
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_invoice_cash_discount/__init__.py' |
2 | --- account_invoice_cash_discount/__init__.py 2010-05-26 13:32:15 +0000 |
3 | +++ account_invoice_cash_discount/__init__.py 2010-06-29 13:29:23 +0000 |
4 | @@ -20,7 +20,8 @@ |
5 | # |
6 | ############################################################################## |
7 | |
8 | +import wizard |
9 | import account_invoice_cash_discount |
10 | -import wizard |
11 | + |
12 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
13 | |
14 | |
15 | === modified file 'account_invoice_cash_discount/__terp__.py' |
16 | --- account_invoice_cash_discount/__terp__.py 2010-06-24 10:49:42 +0000 |
17 | +++ account_invoice_cash_discount/__terp__.py 2010-06-29 13:29:23 +0000 |
18 | @@ -34,7 +34,11 @@ |
19 | "demo_xml" : [ |
20 | ], |
21 | "update_xml" : [ |
22 | +<<<<<<< TREE |
23 | "security/ir.model.access.csv", |
24 | +======= |
25 | + "account_invoice_cash_discount_wizard.xml", |
26 | +>>>>>>> MERGE-SOURCE |
27 | "account_invoice_cash_discount_view.xml", |
28 | 'wizard/account_pay_invoice_view.xml', |
29 | ], |
30 | |
31 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py' |
32 | --- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-08-17 13:38:00 +0000 |
33 | +++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-06-29 13:29:23 +0000 |
34 | @@ -175,7 +175,14 @@ |
35 | if invoice.type in ('in_invoice', 'in_refund'): |
36 | ref = invoice.reference |
37 | else: |
38 | - ref = self._convert_ref(cr, uid, invoice.number) |
39 | + ref = self._convert_ref(cr, uid, invoice.number) |
40 | + |
41 | + discount_amount = 0.0 |
42 | + tax_total_amount = 0.0 |
43 | + |
44 | + if 'cash_amount' in context and context['cash_amount']: |
45 | + discount_amount = context['cash_amount'] |
46 | + |
47 | # Pay attention to the sign for both debit/credit AND amount_currency |
48 | l1 = { |
49 | 'debit': direction * (pay_amount)>0 and direction * (pay_amount), |
50 | @@ -187,7 +194,11 @@ |
51 | 'currency_id':currency_id, |
52 | 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
53 | } |
54 | - |
55 | + |
56 | + ### if we change the amount paid and in the disocunt then it used the changes discount |
57 | + if amount_discount != discount_amount and discount_amount>0.0: |
58 | + amount_discount = discount_amount |
59 | + |
60 | l2 = { |
61 | 'debit': direction * (pay_amount-amount_discount)<0 and - direction * (pay_amount-amount_discount), |
62 | 'credit': direction * (pay_amount-amount_discount)>0 and direction * (pay_amount-amount_discount), |
63 | @@ -201,74 +212,107 @@ |
64 | |
65 | if not name: |
66 | name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
67 | + |
68 | l1['name'] = name |
69 | l2['name'] = name |
70 | lines = [(0, 0, l1), (0, 0, l2)] |
71 | |
72 | - discount_amount = 0.0 |
73 | - tax_total_amount = 0.0 |
74 | - if 'cash_amount' in context and context['cash_amount']: |
75 | - discount_amount = context['cash_amount'] |
76 | - |
77 | - if discount_amount>0.0: |
78 | - for line in invoice.invoice_line: |
79 | - if line.invoice_line_tax_id: |
80 | - for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, discount_amount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
81 | - tax_amount = tax['amount'] |
82 | - tax_total_amount += tax['amount'] |
83 | - |
84 | - tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
85 | - for tax_id in tax_invoice_id: |
86 | - tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
87 | - tax_account_id = tax_value.account_id.id |
88 | - |
89 | - l3 = { |
90 | - 'debit': direction * tax_amount<0 and - direction * tax_amount, |
91 | - 'credit': direction * tax_amount>0 and direction * tax_amount, |
92 | - 'account_id': tax_account_id, |
93 | - 'partner_id': invoice.partner_id.id, |
94 | - 'ref':ref, |
95 | - 'date': date, |
96 | + if 'tax_move_ids' in context and context['tax_move_ids']: |
97 | + move_line = context['tax_move_ids'] |
98 | + for move_line_id in move_line: |
99 | + move_line_data = self.pool.get('account.move.line').browse(cr, uid,move_line_id) |
100 | + l3 = { |
101 | + 'debit': move_line_data.debit, |
102 | + 'credit': move_line_data.credit, |
103 | + 'account_id': move_line_data.account_id.id, |
104 | + 'partner_id': move_line_data.partner_id.id, |
105 | + 'ref':move_line_data.ref, |
106 | + 'date': move_line_data.date, |
107 | + 'currency_id':currency_id, |
108 | + 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
109 | + 'name':move_line_data.name, |
110 | + 'tax_code_id':move_line_data.tax_code_id.id, |
111 | + 'tax_amount':move_line_data.tax_amount, |
112 | + } |
113 | + lines.append((0, 0, l3)) |
114 | + else: |
115 | + if amount_discount>0.0: |
116 | + for line in invoice.invoice_line: |
117 | + if line.invoice_line_tax_id: |
118 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, amount_discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
119 | + tax_amount = tax['amount'] |
120 | + tax_total_amount += tax['amount'] |
121 | + tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
122 | + for tax_id in tax_invoice_id: |
123 | + tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
124 | + tax_account_id = tax_value.account_id.id |
125 | + l3 = { |
126 | + 'debit': direction * tax_amount<0 and - direction * tax_amount, |
127 | + 'credit': direction * tax_amount>0 and direction * tax_amount, |
128 | + 'account_id': tax_account_id, |
129 | + 'partner_id': invoice.partner_id.id, |
130 | + 'ref':ref, |
131 | + 'date': date, |
132 | + 'currency_id':currency_id, |
133 | + 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
134 | + 'tax_code_id':tax_value.tax_code_id.id, |
135 | + 'tax_amount':tax_amount, |
136 | + } |
137 | + l3['name'] = name |
138 | + lines.append((0, 0, l3)) |
139 | + |
140 | + if 'discount_move_ids' in context and context['discount_move_ids']: |
141 | + dis_move_id = context['discount_move_ids'][0] |
142 | + move_id = self.pool.get('account.move.line').search(cr, uid,[('move_id','=',dis_move_id)]) |
143 | + move_line_data = self.pool.get('account.move.line').browse(cr, uid, move_id[0]) |
144 | + l4 = { |
145 | + 'debit': move_line_data.debit, |
146 | + 'credit':move_line_data.credit, |
147 | + 'account_id': move_line_data.account_id.id, |
148 | + 'partner_id': move_line_data.partner_id.id, |
149 | + 'ref':move_line_data.ref, |
150 | + 'date': move_line_data.date, |
151 | 'currency_id':currency_id, |
152 | 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
153 | + 'name':move_line_data.name, |
154 | } |
155 | - l3['name'] = name |
156 | - lines.append((0, 0, l3)) |
157 | - |
158 | - if amount_discount>0: |
159 | - if 'account_id' in context and context['account_id']: |
160 | - account_id = context['account_id'] |
161 | - |
162 | - if tax_total_amount>0: |
163 | - amount_discount = (amount_discount - tax_total_amount) |
164 | - else: |
165 | - amount_discount = amount_discount |
166 | - |
167 | - l4 = { |
168 | - 'debit': direction * amount_discount<0 and - direction * amount_discount, |
169 | - 'credit': direction * amount_discount>0 and direction * amount_discount, |
170 | - 'account_id': account_id, |
171 | - 'partner_id': invoice.partner_id.id, |
172 | - 'ref':ref, |
173 | - 'date': date, |
174 | - 'currency_id':currency_id, |
175 | - 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
176 | - } |
177 | - l4['name'] = name |
178 | lines.append((0, 0, l4)) |
179 | + |
180 | + else: |
181 | + if amount_discount>0: |
182 | + if 'account_id' in context and context['account_id']: |
183 | + account_id = context['account_id'] |
184 | + if tax_total_amount>0: |
185 | + amount_discount = (amount_discount - tax_total_amount) |
186 | + else: |
187 | + amount_discount = amount_discount |
188 | + l4 = { |
189 | + 'debit': direction * amount_discount<0 and - direction * amount_discount, |
190 | + 'credit': direction * amount_discount>0 and direction * amount_discount, |
191 | + 'account_id': account_id, |
192 | + 'partner_id': invoice.partner_id.id, |
193 | + 'ref':ref, |
194 | + 'date': date, |
195 | + 'currency_id':currency_id, |
196 | + 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
197 | + } |
198 | + l4['name'] = name |
199 | + lines.append((0, 0, l4)) |
200 | |
201 | move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date} |
202 | move_id = self.pool.get('account.move').create(cr, uid, move, context=context) |
203 | - |
204 | + |
205 | line_ids = [] |
206 | total = 0.0 |
207 | line = self.pool.get('account.move.line') |
208 | cr.execute('select id from account_move_line where move_id in ('+str(move_id)+','+str(invoice.move_id.id)+')') |
209 | + |
210 | lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) |
211 | for l in lines+invoice.payment_ids: |
212 | if l.account_id.id==src_account_id: |
213 | line_ids.append(l.id) |
214 | total += (l.debit or 0.0) - (l.credit or 0.0) |
215 | + |
216 | if (not round(total,int(config['price_accuracy']))) or writeoff_acc_id: |
217 | self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context) |
218 | else: |
219 | |
220 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml' |
221 | --- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-06-01 05:48:55 +0000 |
222 | +++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-06-29 13:29:23 +0000 |
223 | @@ -45,5 +45,45 @@ |
224 | </field> |
225 | </record> |
226 | |
227 | + <record id="bank_statement_form_view1" model="ir.ui.view"> |
228 | + <field name="name">account.bank.statement.form</field> |
229 | + <field name="model">account.bank.statement</field> |
230 | + <field name="type">form</field> |
231 | + <field name="inherit_id" ref="account.view_bank_statement_form"/> |
232 | + <field name="arch" type="xml"> |
233 | + <xpath expr="//button[@string='Import Invoice']" position="replace"> |
234 | + <button name="%(wizard_populate_statement_from_inv1)d" type="action" string="Import Invoice" attrs="{'invisible':[('state','=','confirm')]}"/> |
235 | + </xpath> |
236 | + </field> |
237 | + </record> |
238 | + |
239 | + <record id="bank_statement_reconcile_form_view1" model="ir.ui.view"> |
240 | + <field name="name">account.bank.statement.reconcile.form</field> |
241 | + <field name="model">account.bank.statement.reconcile</field> |
242 | + <field name="type">form</field> |
243 | + <field name="inherit_id" ref="account.view_bank_statement_reconcile"/> |
244 | + <field name="arch" type="xml"> |
245 | + <field name="total_new" position="replace"> |
246 | + <field name="total_new" string="Total Write Off / Cash Discount"/> |
247 | + </field> |
248 | + </field> |
249 | + </record> |
250 | + |
251 | + <record id="bank_statement_reconcile_form_view2" model="ir.ui.view"> |
252 | + <field name="name">account.bank.statement.reconcile.form</field> |
253 | + <field name="model">account.bank.statement.reconcile</field> |
254 | + <field name="type">form</field> |
255 | + <field name="inherit_id" ref="account.view_bank_statement_reconcile"/> |
256 | + <field name="arch" type="xml"> |
257 | + <xpath expr="//tree[@string='Write-Off']" position="replace"> |
258 | + <tree editable="bottom" string="Write-Off and Cash-Discount"> |
259 | + <field name="account_id" domain="[('type','<>','view'),('type','<>','consolidation')]"/> |
260 | + <field name="amount"/> |
261 | + <field name="name"/> |
262 | + </tree> |
263 | + </xpath> |
264 | + </field> |
265 | + </record> |
266 | + |
267 | </data> |
268 | </openerp> |
269 | |
270 | === modified file 'account_invoice_cash_discount/wizard/__init__.py' |
271 | --- account_invoice_cash_discount/wizard/__init__.py 2010-06-01 05:48:55 +0000 |
272 | +++ account_invoice_cash_discount/wizard/__init__.py 2010-06-29 13:29:23 +0000 |
273 | @@ -21,6 +21,7 @@ |
274 | ############################################################################## |
275 | |
276 | import account_pay_invoice |
277 | +import invoice_statement_payment |
278 | |
279 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
280 | |
281 | |
282 | === modified file 'account_invoice_cash_discount/wizard/account_pay_invoice.py' |
283 | --- account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-08-17 13:38:00 +0000 |
284 | +++ account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-06-29 13:29:23 +0000 |
285 | @@ -58,18 +58,18 @@ |
286 | 'amount': fields.float('Amount paid', required=True), |
287 | 'name': fields.char('Entry Name', size=64, required=True), |
288 | 'date': fields.date('Date payment', required=True), |
289 | + 'cash_residual_amount': fields.float('Residual Amount', readonly=True), |
290 | 'journal_id': fields.many2one('account.journal', 'Journal/Payment Mode', required=True), |
291 | 'period_id': fields.many2one('account.period', 'Period', required=True), |
292 | 'cash_amount':fields.float('Cash Discount Amount',), |
293 | 'account_id': fields.many2one('account.account', 'Account For Discount',), |
294 | + 'cal_method_selection': fields.selection([('method_gross_methodology','Calculate Discount with Net Gross Methodology'), |
295 | + ('method_net_methodology','Calculate Discount with Net Methodology'),], |
296 | + 'Method To Calculation'), |
297 | + 'discount_move_ids': fields.many2many('account.move', 'account_discount_move_rel', 'discount_account_id', 'discount_move_id', 'Account Discount Moves'), |
298 | + 'tax_move_ids': fields.many2many('account.move.line', 'account_tax_move_rel', 'tax_account_id', 'tax_move_id', 'Account Taxes Moves'), |
299 | } |
300 | |
301 | - def view_init(self, cr, uid, ids, context=None): |
302 | - invoice = self.pool.get('account.invoice').browse(cr, uid, context['active_id'], context=context) |
303 | - if invoice.state in ['draft', 'proforma2', 'cancel']: |
304 | - raise osv.except_osv(_('Error !'), _('Can not pay draft/proforma/cancel invoice.')) |
305 | - pass |
306 | - |
307 | def _get_period(self, cr, uid, context=None): |
308 | ids = self.pool.get('account.period').find(cr, uid, context=context) |
309 | period_id = False |
310 | @@ -78,7 +78,10 @@ |
311 | return period_id |
312 | |
313 | def _get_amount(self, cr, uid, context=None): |
314 | - residual_amount = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context).residual |
315 | + obj_inv = self.pool.get('account.invoice') |
316 | + invoice = obj_inv.browse(cr, uid, context['id'], context=context) |
317 | + discount = obj_inv._get_payment(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context) |
318 | + residual_amount = invoice.residual - discount |
319 | return residual_amount |
320 | |
321 | def on_change_ammount(self, cr, uid, ids, amount, context=None): |
322 | @@ -88,8 +91,18 @@ |
323 | res = {} |
324 | obj_inv = self.pool.get('account.invoice') |
325 | invoice = obj_inv.browse(cr, uid, context['id'], context=context) |
326 | - discount = obj_inv._get_payment(cr, uid, [context['id']] , amount, invoice.payment_term.id, context=context) |
327 | - return {'value' : {'cash_amount':discount}} |
328 | + discount = obj_inv._get_payment(cr, uid, [context['id']] , invoice.residual, invoice.payment_term.id, context=context) |
329 | + diff_amount = round(invoice.residual - (amount + discount),2) |
330 | + return {'value' : {'cash_residual_amount':diff_amount}} |
331 | + |
332 | + def on_change_cash_discount_amount(self, cr, uid, ids, discount_amount, amount, context=None): |
333 | + ### Return discount amount |
334 | + res = {} |
335 | + obj_inv = self.pool.get('account.invoice') |
336 | + invoice = obj_inv.browse(cr, uid, context['id'], context=context) |
337 | + diff_amount = 0.0 |
338 | + diff_amount = round(invoice.residual - (amount + discount_amount),2) |
339 | + return {'value' : {'cash_amount':discount_amount,'cash_residual_amount':diff_amount}} |
340 | |
341 | def _get_discount(self, cr, uid, context=None): |
342 | obj_inv = self.pool.get('account.invoice') |
343 | @@ -116,12 +129,89 @@ |
344 | raise osv.except_osv(_('Error !'), _('Can not pay draft/proforma/cancel invoice.')) |
345 | return res |
346 | |
347 | + def _calculation(self, cr, uid, ids, context=None): |
348 | + invoice_obj = self.pool.get('account.invoice') |
349 | + data = self.read(cr, uid, ids,context=context)[0] |
350 | + invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context) |
351 | + tax_obj = self.pool.get('account.tax') |
352 | + invoice_tax_obj = self.pool.get("account.invoice.tax") |
353 | + |
354 | + ######## to get ref |
355 | + if invoice.type in ('in_invoice', 'in_refund'): |
356 | + ref = invoice.reference |
357 | + else: |
358 | + ref = invoice_obj._convert_ref(cr, uid, invoice.number) |
359 | + |
360 | + #### to get direction |
361 | + types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} |
362 | + direction = types[invoice.type] |
363 | + date=time.strftime('%Y-%m-%d') |
364 | + |
365 | + #### to get name |
366 | + name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
367 | + |
368 | + ##### Entry in the discount account moves and entry in the tax account moves |
369 | + |
370 | + ### Entry for taxes in the line of wizard tax |
371 | + if data.get('cash_amount',0.0)>0.0: |
372 | + lines3 = [] |
373 | + tax_total_amount = 0.0 |
374 | + line_ids = [] |
375 | + for line in invoice.invoice_line: |
376 | + if line.invoice_line_tax_id: |
377 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, data['cash_amount'], line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
378 | + tax_amount = tax['amount'] |
379 | + tax_total_amount += tax['amount'] |
380 | + tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
381 | + for tax_id in tax_invoice_id: |
382 | + tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
383 | + tax_account_id = tax_value.account_id.id |
384 | + l3 = { |
385 | + 'debit': direction * tax_amount<0 and - direction * tax_amount, |
386 | + 'credit': direction * tax_amount>0 and direction * tax_amount, |
387 | + 'account_id': tax_account_id, |
388 | + 'partner_id': invoice.partner_id.id, |
389 | + 'ref':ref, |
390 | + 'date': date, |
391 | + 'journal_id':data.get('journal_id',False) , |
392 | + 'period_id':data.get('period_id',False), |
393 | + 'name':name, |
394 | + 'tax_code_id':tax_value.tax_code_id.id, |
395 | + 'tax_amount':tax_amount, |
396 | + } |
397 | + line_id = self.pool.get('account.move.line').create(cr,uid,l3,context=context) |
398 | + line_ids.append(line_id) |
399 | + self.write(cr, uid, ids, {'tax_move_ids':[(6,0,line_ids)]}, context) |
400 | + |
401 | + ### Entry for discount in the line of wizard discount |
402 | + lines4 = [] |
403 | + if tax_total_amount>0: |
404 | + data['cash_amount'] = (data['cash_amount'] - tax_total_amount) |
405 | + |
406 | + l4 = { |
407 | + 'debit': direction * data.get('cash_amount',0.0)<0 and - direction * data.get('cash_amount',0.0), |
408 | + 'credit': direction * data.get('cash_amount',0.0)>0 and direction * data.get('cash_amount',0.0), |
409 | + 'account_id': data['account_id'], |
410 | + 'partner_id': invoice.partner_id.id, |
411 | + 'ref':ref, |
412 | + 'date': date, |
413 | + 'name':name |
414 | + } |
415 | + |
416 | + lines4.append((0, 0, l4)) |
417 | + move = {'ref': ref, 'line_id': lines4, 'journal_id': data['journal_id'], 'period_id': data['period_id'], } |
418 | + move_id = self.pool.get('account.move').create(cr, uid, move, context=context) |
419 | + self.write(cr, uid, ids, {'discount_move_ids':[(6,0,[move_id])]}, context) |
420 | + return True |
421 | + |
422 | _defaults = { |
423 | 'date': lambda *a: time.strftime('%Y-%m-%d'), |
424 | 'period_id': _get_period, |
425 | 'amount': _get_amount, |
426 | 'cash_amount':_get_discount, |
427 | - 'account_id':_get_account |
428 | + 'account_id':_get_account, |
429 | + 'cash_residual_amount': lambda *a:0.0, |
430 | + 'cal_method_selection':lambda *a :'method_gross_methodology', |
431 | } |
432 | |
433 | def wo_check(self, cr, uid, ids, context=None): |
434 | @@ -186,13 +276,13 @@ |
435 | writeoff_account_id = False |
436 | writeoff_journal_id = False |
437 | comment = False |
438 | - |
439 | + |
440 | if 'write_off' in context and context['write_off'] : |
441 | writeoff_account_id = context['write_off']['writeoff_acc_id'] |
442 | writeoff_journal_id = context['write_off']['writeoff_journal_id'] |
443 | comment = context['write_off']['comment'] |
444 | |
445 | - amount = data['amount'] |
446 | + amount = data['amount'] + data['cash_amount'] |
447 | |
448 | invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context) |
449 | journal = self.pool.get('account.journal').browse(cr, uid, data['journal_id'], context=context) |
450 | @@ -203,14 +293,14 @@ |
451 | amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, amount, context=ctx) |
452 | currency_id = journal.currency.id |
453 | # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency |
454 | - context.update({'amount_currency':data['amount'],'currency_id':currency_id}) |
455 | + context.update({'amount_currency':data['amount'] + data['cash_amount'],'currency_id':currency_id}) |
456 | |
457 | if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
458 | ctx = {'date':data['date']} |
459 | amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, amount, context=ctx) |
460 | currency_id = invoice.currency_id.id |
461 | # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency |
462 | - context.update({'amount_currency':data['amount'],'currency_id':currency_id}) |
463 | + context.update({'amount_currency':data['amount'] + data['cash_amount'],'currency_id':currency_id}) |
464 | |
465 | # Take the choosen date |
466 | if comment: |
467 | @@ -218,8 +308,17 @@ |
468 | else: |
469 | context.update({'date_p':data['date'],'comment':False}) |
470 | |
471 | - context.update({'account_id':data['account_id'],'cash_amount':data['cash_amount'],'amount_currency':data['amount']}) |
472 | - |
473 | + context.update({'account_id':data['account_id'],'cash_amount':data['cash_amount'],'amount_currency':data['amount'] + data['cash_amount']}) |
474 | + |
475 | + if data['discount_move_ids']: |
476 | + context.update({'discount_move_ids':data['discount_move_ids']}) |
477 | + |
478 | + if data['tax_move_ids']: |
479 | + context.update({'tax_move_ids':data['tax_move_ids']}) |
480 | + |
481 | + if data['cash_amount']: |
482 | + context.update({'cash_amount':data['cash_amount']}) |
483 | + |
484 | acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id |
485 | if not acc_id: |
486 | raise osv.except_osv(_('Error !'), _('Your journal must have a default credit and debit account.')) |
487 | |
488 | === modified file 'account_invoice_cash_discount/wizard/account_pay_invoice_view.xml' |
489 | --- account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-08-17 13:38:00 +0000 |
490 | +++ account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-06-29 13:29:23 +0000 |
491 | @@ -9,14 +9,27 @@ |
492 | <form string="Pay invoice"> |
493 | <group colspan="4" > |
494 | <field name="amount" on_change="on_change_ammount(amount,context)"/> |
495 | - <newline/> |
496 | + <field name="cash_residual_amount"/> |
497 | <field name="name"/> |
498 | <field name="date"/> |
499 | <field name="journal_id" domain="[('type','=','cash')]"/> |
500 | <field name="period_id"/> |
501 | - <field name="cash_amount" attrs="{'required':[('cash_amount','>',0)]}"/> |
502 | + <field name="cash_amount" on_change="on_change_cash_discount_amount(cash_amount,amount,context)" attrs="{'required':[('cash_amount','>',0)]}"/> |
503 | <field name="account_id" attrs="{'required':[('cash_amount','>',0)]}"/> |
504 | </group> |
505 | + <group> |
506 | + <separator string="Method For Calculation" colspan="4"/> |
507 | + <field name="cal_method_selection" colspan="4" nolabel="1"/> |
508 | + <button icon="gtk-execute" string="Calculate" name="_calculation" type="object"/> |
509 | + </group> |
510 | + <group colspan="4"> |
511 | + <separator string="Account Discount Moves" colspan="4"/> |
512 | + <field name="discount_move_ids" widget="one2many_list" nolabel="1"/> |
513 | + </group> |
514 | + <group colspan="4"> |
515 | + <separator string="Account Taxes Moves" colspan="4"/> |
516 | + <field name="tax_move_ids" widget="one2many_list" nolabel="1"/> |
517 | + </group> |
518 | <group colspan="4" col="6"> |
519 | <label string ="" colspan="2"/> |
520 | <button icon="gtk-cancel" special="cancel" string="Cancel"/> |
521 | |
522 | === modified file 'packing_barcode_check/report/bar_code_check.rml' |
523 | --- packing_barcode_check/report/bar_code_check.rml 2010-06-24 12:19:20 +0000 |
524 | +++ packing_barcode_check/report/bar_code_check.rml 2010-06-29 13:29:23 +0000 |
525 | @@ -1,8 +1,8 @@ |
526 | <?xml version="1.0"?> |
527 | <document filename="test.pdf"> |
528 | - <template pageSize="(320.0,210.0)" rightMargin="0.0cm" title="Test" author="Martin Simon" allowSplitting="20"> |
529 | + <template pageSize="(235.0,210.0)" rightMargin="0.0cm" title="Test" author="Martin Simon" allowSplitting="20"> |
530 | <pageTemplate id="first"> |
531 | - <frame id="first" x1="1.5cm" y1="0.0cm" width="320.0" height="210"/> |
532 | + <frame id="first" x1="65.0" y1="0.0" width="235.0" height="210"/> |
533 | </pageTemplate> |
534 | </template> |
535 | <stylesheet> |