[FIX] purchase(_stock): check style corrections

Part-of: odoo/odoo#135502
This commit is contained in:
svs-odoo
2023-10-26 07:22:56 +00:00
committed by Arnold Moyaux
parent aabcdd2bc6
commit 0a80dbd643
3 changed files with 13 additions and 11 deletions
@@ -89,7 +89,7 @@ class PurchaseOrderLine(models.Model):
def _compute_amount(self):
for line in self:
tax_results = self.env['account.tax']._compute_taxes([line._convert_to_tax_base_line_dict()])
totals = list(tax_results['totals'].values())[0]
totals = next(iter(tax_results['totals'].values()))
amount_untaxed = totals['amount_untaxed']
amount_tax = totals['amount_tax']
@@ -564,9 +564,11 @@ class PurchaseOrderLine(models.Model):
)
def _validate_analytic_distribution(self):
for line in self.filtered(lambda l: not l.display_type):
line._validate_distribution(**{
'product': line.product_id.id,
'business_domain': 'purchase_order',
'company_id': line.company_id.id,
})
for line in self:
if line.display_type:
continue
line._validate_distribution(
product=line.product_id.id,
business_domain='purchase_order',
company_id=line.company_id.id,
)
@@ -131,9 +131,9 @@ class PurchaseOrder(models.Model):
for pick in order.picking_ids.filtered(lambda r: r.state != 'cancel'):
pick.action_cancel()
order.order_line.write({'move_dest_ids':[(5,0,0)]})
order.order_line.write({'move_dest_ids': [(5, 0, 0)]})
return super(PurchaseOrder, self).button_cancel()
return super().button_cancel()
def action_view_picking(self):
return self._get_action_view_picking(self.picking_ids)
@@ -213,14 +213,14 @@ class PurchaseOrderLine(models.Model):
move_dests = self.move_dest_ids
if not move_dests:
move_dests = self.move_ids.move_dest_ids.filtered(lambda m: m.state != 'cancel' and not m.location_dest_id.usage == 'supplier')
move_dests = self.move_ids.move_dest_ids.filtered(lambda m: m.state != 'cancel' and m.location_dest_id.usage != 'supplier')
if not move_dests:
qty_to_attach = 0
qty_to_push = self.product_qty - qty
else:
move_dests_initial_demand = self.product_id.uom_id._compute_quantity(
sum(move_dests.filtered(lambda m: m.state != 'cancel' and not m.location_dest_id.usage == 'supplier').mapped('product_qty')),
sum(move_dests.filtered(lambda m: m.state != 'cancel' and m.location_dest_id.usage != 'supplier').mapped('product_qty')),
self.product_uom, rounding_method='HALF-UP')
qty_to_attach = move_dests_initial_demand - qty
qty_to_push = self.product_qty - move_dests_initial_demand