|
@ -10,33 +10,24 @@ class BeesdooProduct(models.Model): |
|
|
fair_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'fair')]) |
|
|
fair_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'fair')]) |
|
|
origin_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'delivery')]) |
|
|
origin_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'delivery')]) |
|
|
|
|
|
|
|
|
display_unit = fields.Char() |
|
|
|
|
|
default_reference_unit = fields.Char() |
|
|
|
|
|
display_weight = fields.Integer(compute='get_display_weight') |
|
|
|
|
|
|
|
|
display_unit = fields.Many2one('product.uom', required=True) |
|
|
|
|
|
default_reference_unit = fields.Many2one('product.uom', required=True) |
|
|
|
|
|
|
|
|
|
|
|
display_weight = fields.Float(compute='get_display_weight') |
|
|
|
|
|
|
|
|
total = fields.Float(compute='get_total') |
|
|
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') |
|
|
|
|
|
|
|
|
|
|
|
@api.one |
|
|
|
|
|
@api.depends('weight', 'display_unit') |
|
|
def get_display_weight(self): |
|
|
def get_display_weight(self): |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.display_unit: |
|
|
|
|
|
self.display_weight = self.weight / self.display_unit.factor |
|
|
|
|
|
|
|
|
def get_total(self): |
|
|
def get_total(self): |
|
|
price_ht = self.env['product.pricelist'].search([])[0].price_get(self.id, 1)[1] |
|
|
price_ht = self.env['product.pricelist'].search([])[0].price_get(self.id, 1)[1] |
|
|
self.total = price_ht |
|
|
self.total = price_ht |
|
|
|
|
|
|
|
|
# grand_total_by_unit = fields.Float(compute='get_grand_total_by_unit') |
|
|
|
|
|
# |
|
|
|
|
|
# grand_total = fields.Float(compute='get_grand_total') |
|
|
|
|
|
# |
|
|
|
|
|
# def get_grand_total(self): |
|
|
|
|
|
# self.grand_total = self.env['sale.order.line'] * self.price |
|
|
|
|
|
# |
|
|
|
|
|
# def get_grand_total_by_unit(self): |
|
|
|
|
|
# self.grand_total_by_unit = self.grand_total * self.unit_price |
|
|
|
|
|
# product.supplierinfo |
|
|
|
|
|
|
|
|
|
|
|
def get_total_with_vat(self): |
|
|
def get_total_with_vat(self): |
|
|
tax_amount_sum = 0.0 |
|
|
tax_amount_sum = 0.0 |
|
|
for tax in self.taxes_id: |
|
|
for tax in self.taxes_id: |
|
@ -44,7 +35,6 @@ class BeesdooProduct(models.Model): |
|
|
self.total_with_vat = self.total * (100.0 + tax_amount_sum) / 100 |
|
|
self.total_with_vat = self.total * (100.0 + tax_amount_sum) / 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BeesdooProductLabel(models.Model): |
|
|
class BeesdooProductLabel(models.Model): |
|
|
_name = 'beesdoo.product.label' |
|
|
_name = 'beesdoo.product.label' |
|
|
|
|
|
|
|
|