Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] l10n_ar_sale: Consideramos las ventas que provienen de website #220

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions l10n_ar_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,21 @@ def _get_sale_checkbook(self):
@api.model_create_multi
def create(self, vals):
for val in vals:
sale_checkbook_id = val.get('sale_checkbook_id')
sale_checkbook_type = val.get('type_id')
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_id:
sale_checkbook = self.env['sale.checkbook'].browse(
val.get('sale_checkbook_id'))
sale_checkbook_id)
val['name'] = sale_checkbook.sequence_id and\
sale_checkbook.sequence_id._next() or _('New')
elif sale_checkbook_type and not sale_checkbook_id:
sale_checkbook_from_type = self.env['sale.order.type'].browse(sale_checkbook_type).sale_checkbook_id
# Obtenemos el talonario asociado al tipo de venta, esto lo utilizamos si la venta viene de website
# O el usuario no tiene acceso a los talonarios de venta
val['name'] = sale_checkbook_from_type and sale_checkbook_from_type.sequence_id and\
sale_checkbook_from_type.sequence_id._next() or _('New')
return super(SaleOrder, self).create(vals)

def write(self, vals):
Expand Down