Add retention on different receivable account
I'm getting a domain exception in validate_relation_domain when
trying to import invoices with holdbacks (retenue de garantie or RG in French).
File "/home/richard/src/openerp2tryton/baou/migration.py3", line 1208, in migrate_invoice
invoice.save()
File "/usr/lib/python3.6/site-packages/proteus-4.4.1-py3.6.egg/proteus/__init__.py", line 101, in newfunc
return self.func(owner, [instance], *args, **kwargs)
File "/usr/lib/python3.6/site-packages/proteus-4.4.1-py3.6.egg/proteus/__init__.py", line 758, in save
ids = proxy.create(values, context)
File "/usr/lib/python3.6/site-packages/proteus-4.4.1-py3.6.egg/proteus/config.py", line 172, in __call__
result = rpc.result(meth(*args, **kwargs))
File "/opt/trytond/trytond/model/modelsql.py", line 595, in create
field.set(cls, fname, *fargs)
File "/opt/trytond/trytond/model/fields/one2many.py", line 217, in set
Target.create(to_create)
File "/opt/trytond/trytond/modules/account_invoice/invoice.py", line 1935, in create
return super(InvoiceLine, cls).create(vlist)
File "/opt/trytond/trytond/model/modelsql.py", line 604, in create
cls._validate(sub_records)
File "/opt/trytond/trytond/model/modelstorage.py", line 992, in _validate
validate_domain(field)
File "/opt/trytond/trytond/model/modelstorage.py", line 951, in validate_domain
validate_relation_domain(field, sub_records, Relation, domain)
File "/opt/trytond/trytond/model/modelstorage.py", line 974, in validate_relation_domain
error_args=cls._get_error_args(field.name))
File "/opt/trytond/trytond/error.py", line 74, in raise_user_error
raise UserError(error)
trytond.exceptions.UserError: <unprintable UserError object>
The RG account root for clients is 4117xx in the French account plan and is not a 'revenue' account but is currently defined as 'receivable' thus generating an exception during invoice line validation
<record model="account.account.template" id="4117">
<field name="name">Clients - Retenues de garantie</field>
<field name="code">4117</field>
<field name="deferral" eval="True"/>
<field name="kind">receivable</field>
<field name="reconcile" eval="True"/>
<field name="parent" ref="411"/>
</record>
Holdbacks (or RG's) are commonly recorded directly in invoices or demands for advances in construction and other services industries in France where specified by the contract being executed.
I attach a representative example from tissot:Comptabilité et Retenues de garanties, Livre blanc 2012.
Perhaps a 'holdback' type should be created that could be used for these accounts in order to specifically allow for holdback accounts to be included in invoice domain...
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
p7_Compta_et_Retenues_de_garanties_0812.pdf | @risto42 | 2017-10-07 17:11:26.902000 UTC | application/pdf |