changeset ebc9c4014fc4 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset;node=ebc9c4014fc4
description:
Add company domain on write off of reconcile wizard
The user can only select a write off of the same company as the account.
issue9735
review310901002
diffstat:
move.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r 612327ad8182 -r ebc9c4014fc4 move.py
--- a/move.py Mon Nov 02 15:41:42 2020 +0100
+++ b/move.py Thu Nov 05 23:54:36 2020 +0100
@@ -1676,6 +1676,7 @@
defaults = {}
defaults['accounts'] = [a.id for a in self.show.accounts]
defaults['account'] = self.show.account.id
+ defaults['company'] = self.show.account.company.id
defaults['parties'] = [p.id for p in self.show.parties]
defaults['party'] = self.show.party.id if self.show.party else None
defaults['currency_digits'] = self.show.account.company.currency.digits
@@ -1746,6 +1747,7 @@
class ReconcileShow(ModelView):
'Reconcile'
__name__ = 'account.reconcile.show'
+ company = fields.Many2One('company.company', "Company", readonly=True)
accounts = fields.Many2Many('account.account', None, None, 'Account',
readonly=True)
account = fields.Many2One('account.account', 'Account', readonly=True)
@@ -1775,7 +1777,10 @@
'on_change_with_currency_digits')
write_off = fields.Many2One(
'account.move.reconcile.write_off', "Write Off",
- states=_write_off_states, depends=_write_off_depends)
+ domain=[
+ ('company', '=', Eval('company', -1)),
+ ],
+ states=_write_off_states, depends=_write_off_depends + ['company'])
date = fields.Date('Date',
states=_write_off_states, depends=_write_off_depends)
description = fields.Char('Description',
@@ -1790,10 +1795,10 @@
amount = sum(((l.debit - l.credit) for l in self.lines), Decimal(0))
return amount.quantize(exp)
- @fields.depends('account')
+ @fields.depends('company')
def on_change_with_currency_digits(self, name=None):
- if self.account:
- return self.account.company.currency.digits
+ if self.company:
+ return self.company.currency.digits
class CancelMoves(Wizard):