Fix missing unit_price_w_tax set
This commit is contained in:
parent
166b77f007
commit
21106a03d0
|
@ -1250,7 +1250,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
|
||||
def get_tax_amount(self, name):
|
||||
taxes_computed = Booking._get_taxes(self.lines)
|
||||
print('taxes_computed.....', taxes_computed)
|
||||
res = sum([t['amount'] for t in taxes_computed], _ZERO)
|
||||
return self.currency.round(res)
|
||||
|
||||
|
|
12
folio.py
12
folio.py
|
@ -37,6 +37,7 @@ STATES_OP = {
|
|||
|
||||
STATES_MNT = {'readonly': Eval('state') != 'draft'}
|
||||
_ZERO = Decimal('0')
|
||||
ROUND_TWO = Decimal('0.01')
|
||||
|
||||
|
||||
class Folio(ModelSQL, ModelView):
|
||||
|
@ -717,7 +718,6 @@ class Folio(ModelSQL, ModelView):
|
|||
|
||||
folios = cls.search(dom)
|
||||
rooms_not_available_ids = [folio.room.id for folio in folios]
|
||||
print('rooms_not_available_ids', rooms_not_available_ids)
|
||||
dom = ['AND', ['OR',
|
||||
[
|
||||
('start_date', '>=', start_date),
|
||||
|
@ -1583,7 +1583,10 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
number = fields.Char('Number', readonly=True, required=False)
|
||||
date_service = fields.Date('Date Service', required=True)
|
||||
product = fields.Many2One('product.product', 'Product',
|
||||
domain=[('salable', '=', True)], required=True)
|
||||
domain=[
|
||||
('salable', '=', True),
|
||||
('active', '=', True)
|
||||
], required=True)
|
||||
quantity = fields.Integer('Quantity', required=True)
|
||||
invoice_to = fields.Many2One('party.party', 'Invoice To')
|
||||
unit_price = fields.Numeric('Unit Price', digits=(16, 2),
|
||||
|
@ -1750,11 +1753,11 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
def set_unit_price_w_tax(cls, charges, name, value):
|
||||
Tax = Pool().get('account.tax')
|
||||
to_write = []
|
||||
rvalue = Decimal(value).quantize(Decimal('0.01'))
|
||||
rvalue = Decimal(value).quantize(ROUND_TWO)
|
||||
for charge in charges:
|
||||
taxes = charge.product.customer_taxes_used
|
||||
unit_price = Tax.reverse_compute(rvalue, taxes)
|
||||
unit_price = Decimal(unit_price).quantize(Decimal('0.01'))
|
||||
unit_price = Decimal(unit_price).quantize(ROUND_TWO)
|
||||
to_write.extend([[charge], {
|
||||
'unit_price': unit_price,
|
||||
}])
|
||||
|
@ -1824,6 +1827,7 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
def on_change_product(self):
|
||||
if self.product:
|
||||
self.unit_price = round(self.product.template.list_price, 2)
|
||||
self.unit_price_w_tax = round(self.product.sale_price_taxed, 2)
|
||||
self.description = self.product.template.name
|
||||
if self.folio and not self.folio.taxes_exception:
|
||||
self.taxes = [
|
||||
|
|
13
party.py
13
party.py
|
@ -160,20 +160,21 @@ class Party(metaclass=PoolMeta):
|
|||
return address.city_code.id
|
||||
|
||||
def set_country(records, name, value):
|
||||
print("Aqui fue........")
|
||||
print(records, name, value)
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
pass
|
||||
|
||||
def set_subdivision(records, name, value):
|
||||
print("Aqui fue........")
|
||||
print(records, name, value)
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
for rec in records:
|
||||
for address in rec.addresses:
|
||||
address.department_code = value
|
||||
rec.save()
|
||||
|
||||
def set_city(records, name, value):
|
||||
print("Aqui fue........")
|
||||
print(records, name, value)
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
for rec in records:
|
||||
for address in rec.addresses:
|
||||
address.city_code = value
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.127
|
||||
version=6.0.128
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
Loading…
Reference in New Issue