Sergi Almacellas Abellana pushed to branch branch/default at Tryton / Tryton
Commits: 7a3f9774 by Sergi Almacellas Abellana at 2023-01-27T11:55:05+01:00 Limit tax kind of invoice tax based on invoice type - - - - - 1 changed file: - modules/account_invoice/invoice.py Changes: ===================================== modules/account_invoice/invoice.py ===================================== @@ -2746,6 +2746,13 @@ tax = fields.Many2One('account.tax', 'Tax', ondelete='RESTRICT', domain=[ + ['OR', + ('group', '=', None), + ('group.kind', 'in', + If(Eval('_parent_invoice', {}).get('type') == 'out', + ['sale', 'both'], + ['purchase', 'both']), + )], ('company', '=', Eval('_parent_invoice', {}).get('company', 0)), ], states={ @@ -2749,7 +2756,9 @@ ('company', '=', Eval('_parent_invoice', {}).get('company', 0)), ], states={ - 'readonly': ~Eval('manual', False) | _states['readonly'], + 'readonly': ( + ~Eval('manual', False) | ~Bool(Eval('invoice')) + | _states['readonly']), }, depends={'invoice'}) legal_notice = fields.Text("Legal Notice", states=_states) View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/7a3f9774ae64ed35c6bd785a01da5f61a05df7d1 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/7a3f9774ae64ed35c6bd785a01da5f61a05df7d1 You're receiving this email because of your account on foss.heptapod.net.