-
Notifications
You must be signed in to change notification settings - Fork 13
/
party.py
38 lines (32 loc) · 1.29 KB
/
party.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
# This file is part of the account_invoice_ar module for Tryton.
# 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 Pool, PoolMeta
from trytond.pyson import Eval, Or
from trytond.transaction import Transaction
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
pyafipws_fce = fields.Boolean('MiPyme FCE',
states={'readonly': ~Eval('active', True)})
pyafipws_fce_amount = fields.Numeric('MiPyme FCE Amount',
digits=(16, Eval('pyafipws_fce_amount_digits', 2)),
states={
'readonly': Or(
~Eval('pyafipws_fce', False),
~Eval('active', True)),
})
pyafipws_fce_amount_digits = fields.Function(fields.Integer(
'Currency Digits'), 'get_pyafipws_fce_amount_digits')
@staticmethod
def default_pyafipws_fce_amount():
return Decimal('0')
def get_pyafipws_fce_amount_digits(self, name):
pool = Pool()
Company = pool.get('company.company')
company_id = Transaction().context.get('company')
if company_id:
company = Company(company_id)
return company.currency.digits