New TPV functional improvements:
- Fill statement fields from journal type - Add new buttons to sale tpv form - Change scan domain in tpv sale Task #156769
This commit is contained in:
parent
3d7ad58b80
commit
5094f65e5b
|
@ -14,6 +14,8 @@ from . import production
|
|||
from . import location
|
||||
from . import move
|
||||
from . import price_list
|
||||
from . import sale
|
||||
from . import account
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
|
@ -75,10 +77,12 @@ def register():
|
|||
location.Location,
|
||||
move.Move,
|
||||
price_list.PriceList,
|
||||
account.Statement,
|
||||
module='agronomics', type_='model')
|
||||
Pool.register(
|
||||
production.ProductionCostPriceDistributionTemplateProductionTemplate,
|
||||
plot.CreateNewParcels,
|
||||
sale.WizardAddProduct,
|
||||
module='agronomics', type_='wizard')
|
||||
Pool.register(
|
||||
module='agronomics', type_='report')
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from decimal import Decimal
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Statement(metaclass=PoolMeta):
|
||||
__name__ = 'account.statement'
|
||||
|
||||
@fields.depends('journal', 'state', 'lines', 'number_of_lines',
|
||||
'total_amount')
|
||||
def on_change_journal(self):
|
||||
super().on_change_journal()
|
||||
if not self.journal:
|
||||
return
|
||||
if (self.journal.validation == 'amount' and not self.total_amount):
|
||||
self.total_amount = Decimal(0)
|
||||
elif (self.journal.validation == 'number_of_lines' and not
|
||||
self.number_of_lines):
|
||||
self.number_of_lines = 0
|
||||
else:
|
||||
return
|
|
@ -0,0 +1,50 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
|
||||
|
||||
class WizardAddProduct(metaclass=PoolMeta):
|
||||
__name__ = 'sale_pos.add_product'
|
||||
|
||||
def transition_scan_(self):
|
||||
pool = Pool()
|
||||
Product = pool.get('product.product')
|
||||
|
||||
def qty(value):
|
||||
try:
|
||||
return float(value)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
product = None
|
||||
value = self.start.input_value
|
||||
quantity = qty(value)
|
||||
if len(value) > 4:
|
||||
quantity = None
|
||||
|
||||
if not quantity:
|
||||
domain = ['OR', ('code','=', value),
|
||||
('identifiers.code', '=', value),
|
||||
('name', 'like', '%'+value+'%')]
|
||||
products = Product.search(domain)
|
||||
if not products:
|
||||
return 'start'
|
||||
|
||||
if len(products) > 1:
|
||||
self.choose.products = [x.id for x in products]
|
||||
return 'choose'
|
||||
|
||||
product, = products
|
||||
|
||||
self.start.last_product = product
|
||||
|
||||
if quantity and self.start.last_product:
|
||||
product = self.start.last_product
|
||||
|
||||
if not product:
|
||||
return 'start'
|
||||
|
||||
lines = self.add_sale_line(self.start.lines, product, quantity)
|
||||
self.start.lines = lines
|
||||
self.add_lines()
|
||||
return 'start'
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part party_comment module for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="sale_pos_view_form">
|
||||
<field name="model">sale.sale</field>
|
||||
<field name="inherit" ref="sale_pos.sale_pos_view_form"/>
|
||||
<field name="name">sale_pos_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -13,6 +13,9 @@ depends:
|
|||
stock
|
||||
account_invoice
|
||||
account_invoice_line_standalone
|
||||
sale
|
||||
sale_pos
|
||||
account_statement
|
||||
xml:
|
||||
plot.xml
|
||||
party.xml
|
||||
|
@ -26,3 +29,4 @@ xml:
|
|||
contract.xml
|
||||
invoice.xml
|
||||
history.xml
|
||||
sale.xml
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/group[@id='cash']/button[@name='print_ticket']" position="before">
|
||||
<button name="modify_header" icon="tryton-launch"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue