|
@ -6,16 +6,17 @@ from odoo import api, models, _ |
|
|
class AccountMoveLine(models.Model): |
|
|
class AccountMoveLine(models.Model): |
|
|
_inherit = "account.move.line" |
|
|
_inherit = "account.move.line" |
|
|
|
|
|
|
|
|
def _get_computed_price_unit(self): |
|
|
|
|
|
res = super()._get_computed_price_unit() |
|
|
|
|
|
if self.move_id.is_invoice() and self.initial_membership_check(): |
|
|
|
|
|
product = self.product_id |
|
|
|
|
|
|
|
|
@api.depends("product_id", "product_uom_id") |
|
|
|
|
|
def _compute_price_unit(self): |
|
|
|
|
|
super()._compute_price_unit() |
|
|
|
|
|
for line in self: |
|
|
|
|
|
if line.move_id.is_invoice() and line.initial_membership_check(): |
|
|
|
|
|
product = line.product_id |
|
|
if product.initial_discount == "fixed" and product.fixed_discount: |
|
|
if product.initial_discount == "fixed" and product.fixed_discount: |
|
|
res -= product.fixed_discount |
|
|
|
|
|
return res |
|
|
|
|
|
|
|
|
line.price_unit -= product.fixed_discount |
|
|
|
|
|
|
|
|
@api.onchange("product_id") |
|
|
@api.onchange("product_id") |
|
|
def _onchange_product_id(self): |
|
|
|
|
|
|
|
|
def _inverse_product_id(self): |
|
|
super()._onchange_product_id() |
|
|
super()._onchange_product_id() |
|
|
for line in self: |
|
|
for line in self: |
|
|
if not line.product_id or line.display_type in ( |
|
|
if not line.product_id or line.display_type in ( |
|
|