diff --git a/sale_order_batch/models/sale_order_batch.py b/sale_order_batch/models/sale_order_batch.py
index dd80479..637b6e6 100644
--- a/sale_order_batch/models/sale_order_batch.py
+++ b/sale_order_batch/models/sale_order_batch.py
@@ -50,6 +50,7 @@ class SaleOrderBatch(models.Model):
amount_total = fields.Float(compute="_compute_amount_total", string="Total")
product_ids = fields.One2many("sale.order.batch.product", "batch_id")
product_count = fields.Integer(compute="_compute_product_count")
+ partner_credit_warning = fields.Text(compute="_compute_partner_credit_warning")
@api.depends("sale_order_ids.validity_date")
def _compute_validity_date(self):
@@ -80,6 +81,14 @@ class SaleOrderBatch(models.Model):
for batch in self:
batch.product_count = len(batch.product_ids)
+ @api.depends("sale_order_ids.partner_credit_warning")
+ def _compute_partner_credit_warning(self):
+ for batch in self:
+ batch.partner_credit_warning = ""
+ for order in batch.sale_order_ids:
+ if order.partner_credit_warning:
+ batch.partner_credit_warning += order.partner_credit_warning + "\n"
+
def action_view_source_sale_orders(self):
self.ensure_one()
result = self.env["ir.actions.act_window"]._for_xml_id("sale.action_orders")
diff --git a/sale_order_batch/views/sale_order_batch_views.xml b/sale_order_batch/views/sale_order_batch_views.xml
index 3f7752b..2eb1ecc 100644
--- a/sale_order_batch/views/sale_order_batch_views.xml
+++ b/sale_order_batch/views/sale_order_batch_views.xml
@@ -31,8 +31,15 @@
/>