Permit the selection of companies for which to create dunnings
Closes #15066
This commit is contained in:
1 parent
d87a108def
commit
e428655c1e
3 files changed
+21
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Permit the selection of companies for which to create dunnings
|
||||
|
||||
Version 8.0.0 - 2026-04-20
|
||||
--------------------------
|
||||
|
||||
@@ -335,12 +335,22 @@ class CreateDunningStart(ModelView):
|
||||
__name__ = 'account.dunning.create.start'
|
||||
date = fields.Date('Date', required=True,
|
||||
help="Create dunning 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.")
|
||||
|
||||
@staticmethod
|
||||
def default_date():
|
||||
Date = Pool().get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
@classmethod
|
||||
def default_companies(cls):
|
||||
return Transaction().context.get('companies')
|
||||
|
||||
|
||||
class CreateDunning(Wizard):
|
||||
__name__ = 'account.dunning.create'
|
||||
@@ -354,7 +364,14 @@ class CreateDunning(Wizard):
|
||||
def do_create_(self, action):
|
||||
pool = Pool()
|
||||
Dunning = pool.get('account.dunning')
|
||||
Dunning.generate_dunnings(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):
|
||||
Dunning.generate_dunnings(date=self.start.date)
|
||||
return action, {}
|
||||
|
||||
|
||||
|
||||
@@ -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 Dunning for date" id="create"/>
|
||||
<field name="date"/>
|
||||
|
||||
<field name="companies" colspan="2"/>
|
||||
</group>
|
||||
</form>
|
||||
Reference in new issue
Block a user