[fix] create call and date_order condition

This commit is contained in:
Niels Göttsch 2024-07-20 22:56:41 +02:00 committed by Niels Göttsch
parent b48f71c269
commit f13fc66575
2 changed files with 2 additions and 2 deletions

View file

@ -13,7 +13,7 @@ class SaleOrder(models.Model):
""" """
batch = self.env["sale.order.batch"].search([("state", "=", "open")], limit=1) batch = self.env["sale.order.batch"].search([("state", "=", "open")], limit=1)
if not batch: if not batch:
batch = self.env["sale.order.batch"].create() batch = self.env["sale.order.batch"].create({})
for sale_order in self: for sale_order in self:
if not sale_order.batch_id and sale_order.state in ["draft", "sent"]: if not sale_order.batch_id and sale_order.state in ["draft", "sent"]:
sale_order.batch_id = batch sale_order.batch_id = batch

View file

@ -39,7 +39,7 @@ class SaleOrderBatch(models.Model):
required=True, required=True,
readonly=False, readonly=False,
copy=False, copy=False,
states={"closed": [("readonly", False)]}, states={"closed": [("readonly", True)]},
help="Creation date of order batch,\nConfirmation date of confirmed orders.", help="Creation date of order batch,\nConfirmation date of confirmed orders.",
default=fields.Datetime.now, default=fields.Datetime.now,
) )