minor fix invoice type based from party

This commit is contained in:
wilson gomez 2022-01-17 14:51:51 -05:00
parent 8f9edb19a1
commit 95056396df
3 changed files with 25 additions and 15 deletions

View file

@ -1806,16 +1806,21 @@ class AppWindow(FrontWindow):
address_id = ''
if party['addresses']:
address_id = party['addresses'][0]['id']
invoice_type = 'P'
if party['invoice_type']:
invoice_type = party['invoice_type']
values = {
'party': {'id': party_id, 'name': party['name']},
'invoice_address': address_id,
'shipment_address': address_id,
'invoice_type': invoice_type,
}
payment_term = party.get('customer_payment_term')
if payment_term:
values['payment_term'] = payment_term
self.field_invoice_type.set_from_id(invoice_type)
self.store.update(values)
self.party_id = party_id

View file

@ -127,6 +127,7 @@ MODELS = {
'name', 'id_number', 'addresses', 'phone', 'customer_payment_term',
'customer_payment_term.name', 'credit_limit_amount', 'receivable',
'salesman', 'credit_amount', 'street', 'categories_string',
'invoice_type'
]
},
'ir.action.report': {
@ -144,7 +145,7 @@ MODELS = {
'new_sale_automatic', 'default_invoice_type', 'show_product_image',
'print_invoice_payment', 'delivery_product', 'encoded_sale_price',
'delivery_product.list_price', 'delivery_product.code', 'allow_discount_handle',
'cache_products_local', 'show_party_categories', 'delivery_party',
'cache_products_local', 'show_party_categories', 'delivery_party', 'print_lines_product',
]
},
'party.address': {

View file

@ -122,6 +122,7 @@ class Receipt(object):
self._show_position = context.get('show_position')
self._show_discount = context.get('show_discount')
self._print_lines_product = context.get('print_lines_product')
self._img_logo = logo if logo else None
# if logo:
# self._img_logo = StringIO(logo)
@ -857,7 +858,9 @@ class Receipt(object):
_charge_to = 'Empresa'
self._printer.text('CARGO DEL DOMICILIO: ' + _charge_to)
self.print_enter()
if self.order_kind == 'dispatch':
self._printer.text('FORMA DE PAGO: ' + order.get('payment_term', ''))
self.print_enter()
position = order.get('position')
if position:
self._printer.text('POSICION: %s' % str(position))
@ -891,21 +894,22 @@ class Receipt(object):
self._printer.set(align='left')
self._printer.set(custom_size=True, width=1, height=2)
self.print_horinzontal_double_line()
if not self._print_lines_product:
self.print_horinzontal_double_line()
self.print_enter()
for line in order['lines']:
if self.order_kind == 'command':
self._printer.set(custom_size=True, width=1, height=2)
qty = ' ' + str(int(Decimal(line['quantity'])))
self.print_col(qty, self.order_col_1)
self.print_col(line['name'], col_width_name)
if line['note']:
self.print_enter()
for msg_note in line['note'].split('\n'):
self._printer.text(f' NOTA -> {msg_note}')
self.print_enter()
self.print_enter()
for line in order['lines']:
if self.order_kind == 'command':
self._printer.set(custom_size=True, width=1, height=2)
qty = ' ' + str(int(Decimal(line['quantity'])))
self.print_col(qty, self.order_col_1)
self.print_col(line['name'], col_width_name)
if line['note']:
self.print_enter()
for msg_note in line['note'].split('\n'):
self._printer.text(f' NOTA -> {msg_note}')
self.print_enter()
self.print_enter()
self.print_enter()
self.print_horinzontal_double_line()