Fix
This commit is contained in:
parent
8171310778
commit
1106a077b4
17
sale.py
17
sale.py
|
@ -177,6 +177,7 @@ class Sale(metaclass=PoolMeta):
|
|||
User = Pool().get('res.user')
|
||||
context = Transaction().context
|
||||
today = date.today()
|
||||
print('>>>>>>>>', args)
|
||||
if context.get('shop'):
|
||||
shop = Shop(context['shop'])
|
||||
else:
|
||||
|
@ -187,13 +188,11 @@ class Sale(metaclass=PoolMeta):
|
|||
if v.get('id'):
|
||||
del v['id']
|
||||
v['type'] = 'line'
|
||||
product = Product(v['product.']['id'])
|
||||
unit_price = v['product.']['list_price']
|
||||
v['unit_price'] = Decimal(unit_price).quantize(Decimal(str(10.0 ** -4)))
|
||||
v['base_price'] = Decimal(unit_price).quantize(Decimal(str(10.0 ** -4)))
|
||||
if v.get('product.'):
|
||||
del v['product.']
|
||||
v['product'] = product.id
|
||||
product = Product(v['product'])
|
||||
unit_price = product.template.list_price
|
||||
unit_price = unit_price.quantize(Decimal(str(10.0 ** -4)))
|
||||
v['unit_price'] = unit_price
|
||||
v['base_price'] = unit_price
|
||||
v['unit'] = product.template.default_uom.id
|
||||
v['description'] = product.name
|
||||
taxes = list(product.account_category.customer_taxes_used)
|
||||
|
@ -204,7 +203,7 @@ class Sale(metaclass=PoolMeta):
|
|||
'shop': shop.id,
|
||||
'party': party.id,
|
||||
'invoice_type':'P',
|
||||
'table_assigned': args['table_assigned.']['id'],
|
||||
'table_assigned': args['table_assigned']['id'],
|
||||
'shipment_address': party.addresses[0].id,
|
||||
'invoice_address': party.addresses[0].id,
|
||||
'company': shop.company.id,
|
||||
|
@ -215,6 +214,8 @@ class Sale(metaclass=PoolMeta):
|
|||
'state': 'draft',
|
||||
'lines': [('create', args['lines'])],
|
||||
}
|
||||
if args.get('description'):
|
||||
to_create['description'] = args.get('description')
|
||||
try:
|
||||
sale, = cls.create([to_create])
|
||||
except Exception as e:
|
||||
|
|
3
setup.py
3
setup.py
|
@ -89,7 +89,6 @@ setup(name=name,
|
|||
'Natural Language :: English',
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
|
@ -109,4 +108,4 @@ setup(name=name,
|
|||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue