diff --git a/l10n_ar_sale/models/sale_order.py b/l10n_ar_sale/models/sale_order.py index e04c8870..ec5ed3f3 100644 --- a/l10n_ar_sale/models/sale_order.py +++ b/l10n_ar_sale/models/sale_order.py @@ -57,12 +57,10 @@ def _get_sale_checkbook(self): def create(self, vals): for val in vals: if self.env.user.has_group('l10n_ar_sale.use_sale_checkbook') and \ - val.get('name', _('New')) == _('New') and \ - val.get('sale_checkbook_id'): + val.get('sale_checkbook_id'): sale_checkbook = self.env['sale.checkbook'].browse( val.get('sale_checkbook_id')) - val['name'] = sale_checkbook.sequence_id and\ - sale_checkbook.sequence_id._next() or _('New') + val['name'] = sale_checkbook.sequence_id._next() or _('New') return super(SaleOrder, self).create(vals) def _compute_tax_totals(self): diff --git a/l10n_ar_sale_order_type/models/sale_order.py b/l10n_ar_sale_order_type/models/sale_order.py index 9cdeee84..d6da0ac2 100644 --- a/l10n_ar_sale_order_type/models/sale_order.py +++ b/l10n_ar_sale_order_type/models/sale_order.py @@ -27,8 +27,9 @@ def write(self, vals): record.state in {"draft", "sent"} and record.type_id.sequence_id != sale_checkbook.sequence_id ): + number_next = sale_checkbook.sequence_id.number_next_actual new_vals = vals.copy() - new_vals["name"] = sale_checkbook.sequence_id._next() or _('New') + new_vals["name"] = sale_checkbook.sequence_id.get_next_char(number_next) super(SaleOrder, record).write(new_vals) else: super(SaleOrder, record).write(vals)