Skip to content

Commit

Permalink
[FIX] l10n_ar_sale_order_type: Fix para que se setee correctamente la…
Browse files Browse the repository at this point in the history
… secuencia de la orden de venta

Ticket: 78413
  • Loading branch information
mem-adhoc committed Aug 7, 2024
1 parent ebeae18 commit 081a0ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 11 additions & 6 deletions l10n_ar_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ 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'):
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.get('sale_checkbook_id'):
sale_checkbook = self.env['sale.checkbook'].browse(val.get('sale_checkbook_id'))
number_next = sale_checkbook.sequence_id.number_next_actual
val['name'] = sale_checkbook.sequence_id.get_next_char(number_next) or _('New')
return super(SaleOrder, self).create(vals)

def action_confirm(self):
#Consumimos un numero de la secuencia solamente cuando confirmamos la orden de venta
if self.sale_checkbook_id:
self.name = self.sale_checkbook_id.sequence_id._next()

return super().action_confirm()

def _compute_tax_totals(self):
""" Mandamos en contexto el invoice_date para calculo de impuesto con partner aliquot
ver módulo l10n_ar_account_withholding. """
Expand Down
3 changes: 2 additions & 1 deletion l10n_ar_sale_order_type/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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)
Expand Down

0 comments on commit 081a0ed

Please sign in to comment.