[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -6,21 +6,25 @@ from odoo import fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
_inherit = "sale.order"
route_id = fields.Many2one(
'stock.location.route', string='Route',
ondelete='restrict', readonly=True, tracking=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
"stock.location.route",
string="Route",
ondelete="restrict",
readonly=True,
tracking=True,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
check_company=True,
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]")
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]",
)
def _action_confirm(self):
# Takes into account the scenario where route_id has a value, then SO is
# cancelled+back to draft, then route_id = False and SO is confirmed again
for order in self:
vals = {'route_id': order.route_id.id or False}
vals = {"route_id": order.route_id.id or False}
order.order_line.filtered(
lambda l:
l.product_id and l.product_id.type in ('product', 'consu')).write(vals)
lambda l: l.product_id and l.product_id.type in ("product", "consu")
).write(vals)
return super()._action_confirm()