Merge lp:~rr.clearcorp/openobject-addons/7.0-base_intercompany_sale into lp:~clearcorp-drivers/openobject-addons/elico-7.0-ccorp

Proposed by Ronald Rubi on 2014-08-01
Status: Merged
Merged at revision: 37
Proposed branch: lp:~rr.clearcorp/openobject-addons/7.0-base_intercompany_sale
Merge into: lp:~clearcorp-drivers/openobject-addons/elico-7.0-ccorp
Diff against target: 82 lines (+50/-0)
2 files modified
base_intercompany_sale/purchase.py (+25/-0)
base_intercompany_sale/sale.py (+25/-0)
To merge this branch: bzr merge lp:~rr.clearcorp/openobject-addons/7.0-base_intercompany_sale
Reviewer Review Type Date Requested Status
ClearCorp drivers 2014-08-01 Pending
Review via email: mp+229257@code.launchpad.net

Description of the change

[FIX] Fix discount. price_unit and taxes in base_intercompany_sale

To post a comment you must log in.
37. By Ronald Rubi on 2014-08-01

[MRG] Fix discount. price_unit and taxes in base_intercompany_sale

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'base_intercompany_sale/purchase.py'
--- base_intercompany_sale/purchase.py 2014-02-18 12:28:09 +0000
+++ base_intercompany_sale/purchase.py 2014-08-01 16:39:58 +0000
@@ -277,6 +277,8 @@
277277
278 @mapping278 @mapping
279 def price(self, record):279 def price(self, record):
280 if record.price_unit:
281 return {'price_unit': record.price_unit}
280 if not record.product_id:282 if not record.product_id:
281 return {'price_unit': 0}283 return {'price_unit': 0}
282 sess = self.session284 sess = self.session
@@ -294,3 +296,26 @@
294 record.product_id.id, record.product_qty)296 record.product_id.id, record.product_qty)
295 price = price_unit[int(pricelist_id)]297 price = price_unit[int(pricelist_id)]
296 return {'price_unit': price}298 return {'price_unit': price}
299
300 @mapping
301 def discount(self, record):
302 if record.discount:
303 return {'discount': record.discount}
304 return {'discount': 0}
305
306 @mapping
307 def taxes(self, record):
308 sess = self.session
309 backend = self._backend_to
310 ic_uid = backend.icops_uid.id
311 taxes_id = []
312 if record.order_id:
313 if record.product_id:
314 for tax in record.product_id.taxes_id:
315 if tax.company_id.id == backend.company_id.id:
316 taxes_id.append(tax)
317 line_tax_ids = sess.pool.get('account.fiscal.position').map_tax(sess.cr, ic_uid, record.order_id.fiscal_position, taxes_id)
318 line_taxs = sess.pool.get('account.tax').browse(sess.cr, ic_uid, line_tax_ids)
319 tax_id = [(6, 0, [x.id for x in line_taxs])]
320 return {'tax_id': tax_id}
321 return {'tax_id': []}
297322
=== modified file 'base_intercompany_sale/sale.py'
--- base_intercompany_sale/sale.py 2014-02-18 12:28:09 +0000
+++ base_intercompany_sale/sale.py 2014-08-01 16:39:58 +0000
@@ -332,6 +332,8 @@
332 return {'name': record.name}332 return {'name': record.name}
333333
334 def _price(self, record, is_po=False):334 def _price(self, record, is_po=False):
335 if record.price_unit:
336 return {'price_unit': record.price_unit}
335 if not record.product_id:337 if not record.product_id:
336 return {'price_unit': 0}338 return {'price_unit': 0}
337 sess = self.session339 sess = self.session
@@ -355,6 +357,29 @@
355 record.product_id.id, record.product_uom_qty)357 record.product_id.id, record.product_uom_qty)
356 price = price_unit[int(pricelist_id)]358 price = price_unit[int(pricelist_id)]
357 return {'price_unit': price}359 return {'price_unit': price}
360
361 @mapping
362 def discount(self, record):
363 if record.discount:
364 return {'discount': record.discount}
365 return {'discount': 0}
366
367 @mapping
368 def taxes(self, record):
369 sess = self.session
370 backend = self._backend_to
371 ic_uid = backend.icops_uid.id
372 taxes_id = []
373 if record.order_id:
374 if record.product_id:
375 for tax in record.product_id.taxes_id:
376 if tax.company_id.id == backend.company_id.id:
377 taxes_id.append(tax)
378 line_tax_ids = sess.pool.get('account.fiscal.position').map_tax(sess.cr, ic_uid, record.order_id.fiscal_position, taxes_id)
379 line_taxs = sess.pool.get('account.tax').browse(sess.cr, ic_uid, line_tax_ids)
380 tax_id = [(6, 0, [x.id for x in line_taxs])]
381 return {'taxes_id': tax_id}
382 return {'taxes_id': []}
358383
359 @mapping384 @mapping
360 def map_all(self, record):385 def map_all(self, record):

Subscribers

People subscribed via source and target branches

to all changes: