se adicion campo fields.Amount
FossilOrigin-Name: b23b2c243daaf0788cf47736015d75eecae9f4eb55cd4d31b9e063d7fa9a0691
This commit is contained in:
@@ -489,3 +489,20 @@ def test_model_attributes_order():
|
||||
|
||||
assert '<Invoice><Line1 quantity="1"/><Line2 quantity="2"/><Line3 quantity="3"/></Invoice>' == invoice.to_xml()
|
||||
|
||||
|
||||
def test_field_amount():
|
||||
class Line(facho.model.Model):
|
||||
__name__ = 'Line'
|
||||
|
||||
amount = fields.Amount(name='Amount', precision=0)
|
||||
amount_as_attribute = fields.Attribute('amount')
|
||||
|
||||
@fields.on_change(['amount'])
|
||||
def on_amount(self, name, value):
|
||||
self.amount_as_attribute = self.amount
|
||||
|
||||
line = Line()
|
||||
line.amount = 33
|
||||
|
||||
assert '<Line amount="33"/>' == line.to_xml()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ def _test_simple_invoice_cufe():
|
||||
invoice.customer.party.id = '800199436'
|
||||
|
||||
line = invoice.lines.create()
|
||||
line.quantity = form.Quantity(1, '94')
|
||||
line.price = form.Amount(1_500_000)
|
||||
line.quantity = 1
|
||||
line.price = 1_500_000
|
||||
subtotal = line.taxtotal.subtotals.create()
|
||||
subtotal.percent = 19.0
|
||||
|
||||
Reference in New Issue
Block a user