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