Browse Source

remove total base on pricelist and use list_price instead

pull/9/head
gregoire 9 years ago
parent
commit
01174cd880
  1. 8
      beesdoo_product/models/beesdoo_product.py
  2. 2
      beesdoo_product/views/beesdoo_product.xml

8
beesdoo_product/models/beesdoo_product.py

@ -15,7 +15,6 @@ class BeesdooProduct(models.Model):
display_weight = fields.Float(compute='get_display_weight') display_weight = fields.Float(compute='get_display_weight')
total = fields.Float(compute='get_total')
total_with_vat = fields.Float(compute='get_total_with_vat') total_with_vat = fields.Float(compute='get_total_with_vat')
total_with_vat_by_unit = fields.Float(compute='get_total_with_vat_by_unit') total_with_vat_by_unit = fields.Float(compute='get_total_with_vat_by_unit')
@ -26,18 +25,13 @@ class BeesdooProduct(models.Model):
if self.display_unit: if self.display_unit:
self.display_weight = self.weight / self.display_unit.factor self.display_weight = self.weight / self.display_unit.factor
@api.one
def get_total(self):
price_ht = self.env['product.pricelist'].search([])[0].price_get(self.id, 1)[1]
self.total = price_ht
@api.one @api.one
def get_total_with_vat(self): def get_total_with_vat(self):
tax_amount_sum = 0.0 tax_amount_sum = 0.0
if hasattr(self, 'taxes_id'): if hasattr(self, 'taxes_id'):
for tax in self.taxes_id: for tax in self.taxes_id:
tax_amount_sum = tax_amount_sum + tax.amount tax_amount_sum = tax_amount_sum + tax.amount
self.total_with_vat = self.total * (100.0 + tax_amount_sum) / 100
self.total_with_vat = self.list_price * (100.0 + tax_amount_sum) / 100
@api.one @api.one
def get_total_with_vat_by_unit(self): def get_total_with_vat_by_unit(self):

2
beesdoo_product/views/beesdoo_product.xml

@ -9,9 +9,9 @@
<page string="Price tag"> <page string="Price tag">
<group name="label"> <group name="label">
<field name="total_with_vat"/> <field name="total_with_vat"/>
<field name="total_with_vat_by_unit"/>
<field name="default_reference_unit"/> <field name="default_reference_unit"/>
<field name="display_weight"/> <field name="display_weight"/>
<field name="total_with_vat_by_unit"/>
</group> </group>
<group> <group>
<field name="eco_label"/> <field name="eco_label"/>

Loading…
Cancel
Save