[UPD] pre-commit

This commit is contained in:
Lois Rilo
2022-02-10 13:46:46 +01:00
parent 13e3a4bf77
commit 6275b23ceb
3 changed files with 8 additions and 31 deletions

View File

@@ -37,8 +37,7 @@ class RmaAddStockMove(models.TransientModel):
domain="[('state', '=', 'done')]", domain="[('state', '=', 'done')]",
) )
show_lot_filter = fields.Boolean( show_lot_filter = fields.Boolean(
string="Show lot filter?", string="Show lot filter?", compute="_compute_lot_domain",
compute="_compute_lot_domain",
) )
lot_domain_ids = fields.Many2many( lot_domain_ids = fields.Many2many(
comodel_name="stock.production.lot", comodel_name="stock.production.lot",
@@ -46,9 +45,7 @@ class RmaAddStockMove(models.TransientModel):
compute="_compute_lot_domain", compute="_compute_lot_domain",
) )
@api.depends( @api.depends("move_ids.move_line_ids.lot_id")
"move_ids.move_line_ids.lot_id",
)
def _compute_lot_domain(self): def _compute_lot_domain(self):
for rec in self: for rec in self:
rec.lot_domain_ids = rec.mapped("move_ids.move_line_ids.lot_id").ids rec.lot_domain_ids = rec.mapped("move_ids.move_line_ids.lot_id").ids
@@ -60,11 +57,7 @@ class RmaAddStockMove(models.TransientModel):
def select_all(self): def select_all(self):
self.ensure_one() self.ensure_one()
self.write( self.write({"lot_ids": [(6, 0, self.lot_domain_ids.ids)]})
{
"lot_ids": [(6, 0, self.lot_domain_ids.ids)],
}
)
return { return {
"type": "ir.actions.act_window", "type": "ir.actions.act_window",
"name": _("Add from Stock Move"), "name": _("Add from Stock Move"),

View File

@@ -206,17 +206,8 @@ class RmaMakePicking(models.TransientModel):
): ):
move.move_line_ids.unlink() move.move_line_ids.unlink()
if move.product_id.tracking == "serial": if move.product_id.tracking == "serial":
move.write( move.write({"lot_ids": [(6, 0, move.rma_line_id.lot_id.ids)]})
{ move.move_line_ids.write({"product_uom_qty": 1, "qty_done": 0})
"lot_ids": [(6, 0, move.rma_line_id.lot_id.ids)],
}
)
move.move_line_ids.write(
{
"product_uom_qty": 1,
"qty_done": 0,
}
)
elif move.product_id.tracking == "lot": elif move.product_id.tracking == "lot":
if picking_type == "incoming": if picking_type == "incoming":
qty = self.item_ids.filtered( qty = self.item_ids.filtered(

View File

@@ -42,8 +42,7 @@ class RmaAddSale(models.TransientModel):
string="Sale Lines", string="Sale Lines",
) )
show_lot_filter = fields.Boolean( show_lot_filter = fields.Boolean(
string="Show lot filter?", string="Show lot filter?", compute="_compute_lot_domain",
compute="_compute_lot_domain",
) )
lot_domain_ids = fields.Many2many( lot_domain_ids = fields.Many2many(
comodel_name="stock.production.lot", comodel_name="stock.production.lot",
@@ -51,9 +50,7 @@ class RmaAddSale(models.TransientModel):
compute="_compute_lot_domain", compute="_compute_lot_domain",
) )
@api.depends( @api.depends("sale_line_ids.move_ids.move_line_ids.lot_id",)
"sale_line_ids.move_ids.move_line_ids.lot_id",
)
def _compute_lot_domain(self): def _compute_lot_domain(self):
for rec in self: for rec in self:
rec.lot_domain_ids = ( rec.lot_domain_ids = (
@@ -70,11 +67,7 @@ class RmaAddSale(models.TransientModel):
def select_all(self): def select_all(self):
self.ensure_one() self.ensure_one()
self.write( self.write({"lot_ids": [(6, 0, self.lot_domain_ids.ids)]})
{
"lot_ids": [(6, 0, self.lot_domain_ids.ids)],
}
)
return { return {
"type": "ir.actions.act_window", "type": "ir.actions.act_window",
"name": _("Add Sale Order"), "name": _("Add Sale Order"),