define field uvt_pos

for validate limit uvt on invoice pos
This commit is contained in:
Wilson Gomez 2023-03-17 12:34:36 -05:00
parent ab1d9c2465
commit 55377fcce9
7 changed files with 24 additions and 40 deletions

View File

@ -59,6 +59,7 @@ class Configuration(metaclass=PoolMeta):
('type','!=', None),
])
print_invoice_short = fields.Boolean('Invoice Short')
uvt_pos = fields.Float('Amount Uvt', help='Set amount uvt for restrict sell invoices pos')
@staticmethod
def default_show_stock_pos():

29
sale.py
View File

@ -292,10 +292,16 @@ class Sale(metaclass=PoolMeta):
@classmethod
def _get_products_order(cls, sale, products):
orders = {}
fields = [
'shop.id', 'party.name', 'position', 'invoice_number', 'number', 'turn',
'delivery_charge', 'comment', 'payment_term', 'shop.name'
]
shop_id, party_name, position, invoice_number, number, turn, delivery_charge, comment, payment_term, shop_name = attrgetter(*fields)(sale)
consumer = sale._get_info_consumer()
for (product, qty, unit_price, notes) in products.values():
template = product.template
for printer in template.printers:
shop_id = sale.shop.id
# shop_id = sale.shop.id
if printer.shop.id != shop_id:
continue
printer_id = str(printer.id)
@ -307,18 +313,18 @@ class Sale(metaclass=PoolMeta):
'interface': printer.interface,
'host': printer.host,
'row_characters': printer.row_characters or 48,
'turn': sale.turn or '',
'sale_number': sale.number or '',
'number': sale.invoice_number or '',
'position': sale.position or '',
'party': sale.party.name,
'turn': turn or '',
'sale_number': number or '',
'number': invoice_number or '',
'position': position or '',
'party': party_name,
'salesman': salesman,
'consumer': sale._get_info_consumer(),
'comment': sale.comment or '',
'delivery_charge': sale.delivery_charge,
'payment_term': sale.payment_term.name if sale.payment_term else '',
'consumer': consumer,
'comment': comment or '',
'delivery_charge': delivery_charge,
'payment_term': payment_term.name if payment_term else '',
'total_amount': sale.total_amount_cache or str(sale.total_amount),
'shop': sale.shop.name,
'shop': shop_name,
'lines': [],
}
if hasattr(sale, 'kind'):
@ -334,6 +340,7 @@ class Sale(metaclass=PoolMeta):
'unit_price': int(unit_price),
'note': notes,
})
print('orders return', orders)
return orders
def _updated_amounts(self):

View File

@ -18,11 +18,11 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="name">sale_pos_form</field>
</record>
<record model="ir.ui.view" id="sale_line_view_tree">
<!-- <record model="ir.ui.view" id="sale_line_view_tree">
<field name="model">sale.line</field>
<field name="inherit" ref="sale_pos.sale_line_view_tree"/>
<field name="name">sale_pos_line_tree</field>
</record>
</record> -->
<record model="ir.ui.view" id="sale_line_view_form">
<field name="model">sale.line</field>

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.4
version=6.0.5
depends:
product
account

View File

@ -3,6 +3,8 @@
copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='sale_shipment_method']" position="after">
<label name="uvt_pos"/>
<field name="uvt_pos"/>
<label name="printing_taxes_receipt"/>
<field name="printing_taxes_receipt"/>
<label name="tip_product"/>

View File

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of sale_weight module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='amount_w_tax']"
position="after">
<label name="discount"/>
<field name="discount" factor="100"/>
</xpath>
</data>

View File

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of sale_weight module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='unit_price']"
position="after">
<field name="discount" factor="100">
<suffix name="discount" string="%"/>
</field>
</xpath>
<xpath expr="/tree/field[@name='unit_price']"
position="before">
<field name="base_price"/>
</xpath>
</data>