details: https://code.tryton.org/tryton/commit/720da3b22f40
branch: default
user: Cédric Krier <[email protected]>
date: Fri Sep 04 22:10:07 2026 +0200
description:
Permit the selection of companies for which to create direct debits
Closes #15067
diffstat:
modules/account_payment/CHANGELOG | 1 +
modules/account_payment/account.py | 19
+++++++++-
modules/account_payment/view/move_line_create_direct_debit_form.xml | 2 +
3 files changed, 21 insertions(+), 1 deletions(-)
diffs (60 lines):
diff -r 8423a14bfd14 -r 720da3b22f40 modules/account_payment/CHANGELOG
--- a/modules/account_payment/CHANGELOG Fri Sep 04 22:09:07 2026 +0200
+++ b/modules/account_payment/CHANGELOG Fri Sep 04 22:10:07 2026 +0200
@@ -1,3 +1,4 @@
+* Permit the selection of companies for which to create direct debits
Version 8.0.0 - 2026-04-20
--------------------------
diff -r 8423a14bfd14 -r 720da3b22f40 modules/account_payment/account.py
--- a/modules/account_payment/account.py Fri Sep 04 22:09:07 2026 +0200
+++ b/modules/account_payment/account.py Fri Sep 04 22:10:07 2026 +0200
@@ -351,7 +351,14 @@
def do_create_(self, action):
pool = Pool()
Line = pool.get('account.move.line')
- payments = Line.pay_direct_debit(date=self.start.date)
+ User = pool.get('res.user')
+ transaction = Transaction()
+
+ companies = {c.id for c in self.start.companies}
+ companies &= set(User.get_companies())
+
+ with transaction.set_context(_companies=companies):
+ payments = Line.pay_direct_debit(date=self.start.date)
action['domains'] = []
return action, {
'res_id': [p.id for p in payments],
@@ -364,11 +371,21 @@
date = fields.Date(
"Date", required=True,
help="Create direct debit for lines due up to this date.")
+ companies = fields.Many2Many(
+ 'company.company', None, None, "Companies", required=True,
+ domain=[
+ ('id', 'in', Eval('context', {}).get('companies', [])),
+ ],
+ help="Limit to lines from these companies.")
@classmethod
def default_date(cls):
return Pool().get('ir.date').today()
+ @classmethod
+ def default_companies(cls):
+ return Transaction().context.get('companies')
+
class PayLineStart(ModelView):
__name__ = 'account.move.line.pay.start'
diff -r 8423a14bfd14 -r 720da3b22f40
modules/account_payment/view/move_line_create_direct_debit_form.xml
--- a/modules/account_payment/view/move_line_create_direct_debit_form.xml
Fri Sep 04 22:09:07 2026 +0200
+++ b/modules/account_payment/view/move_line_create_direct_debit_form.xml
Fri Sep 04 22:10:07 2026 +0200
@@ -6,5 +6,7 @@
<group col="2" xexpand="1" id="create_date">
<label string="Create Direct Debit for date" id="create"/>
<field name="date"/>
+
+ <field name="companies" colspan="2"/>
</group>
</form>