Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
grindtildeath committed Jul 25, 2024
1 parent 95db4bd commit ea80edc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sale_triple_discount/migrations/16.0.2.0.0/pre-migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def migrate_discount_to_discount1(env):
"sale_triple_discount",
0.0,
)
]
],
)
openupgrade.logged_query(
env.cr,
"""
UPDATE sale_order_line
SET discount1 = discount;
"""
""",
)


Expand Down
8 changes: 4 additions & 4 deletions sale_triple_discount/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ def _discount_fields(self):
return ["discount1", "discount2", "discount3"]

# Copy of Odoo function to change field being assigned from discount to discount1
@api.depends('product_id', 'product_uom', 'product_uom_qty')
@api.depends("product_id", "product_uom", "product_uom_qty")
def _compute_discount(self):
for line in self:
if not line.product_id or line.display_type:
line.discount1 = 0.0

if not (
line.order_id.pricelist_id
and line.order_id.pricelist_id.discount_policy == 'without_discount'
and line.order_id.pricelist_id.discount_policy == "without_discount"
):
continue

Expand All @@ -106,10 +106,10 @@ def _compute_discount(self):
continue

line.discount1 = line._calc_discount_from_pricelist()

def _calc_discount_from_pricelist(self):
self.ensure_one()
line = self.with_company(self.company_id)
self = self.with_company(self.company_id)
pricelist_price = self._get_pricelist_price()
base_price = self._get_pricelist_price_before_discount()

Expand Down

0 comments on commit ea80edc

Please sign in to comment.