Permit the selection of companies for which to create direct debits
Closes #15067
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Permit the selection of companies for which to create direct debits
|
||||
|
||||
Version 8.0.0 - 2026-04-20
|
||||
--------------------------
|
||||
|
||||
@@ -351,7 +351,14 @@ class CreateDirectDebit(Wizard):
|
||||
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 @@ class CreateDirectDebitStart(ModelView):
|
||||
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'
|
||||
|
||||
@@ -6,5 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user