Browse Source

Merge PR #662 into 13.0

Signed-off-by pedrobaeza
pull/670/head
OCA-git-bot 5 years ago
parent
commit
efe04756df
  1. 2
      .isort.cfg
  2. 3
      account_tax_balance/models/account_tax.py
  3. 14
      account_tax_balance/wizard/open_tax_balances.py
  4. 2
      account_tax_balance/wizard/open_tax_balances_view.xml

2
.isort.cfg

@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=dateutil,psycopg2
known_third_party=dateutil,psycopg2,setuptools

3
account_tax_balance/models/account_tax.py

@ -26,10 +26,11 @@ class AccountTax(models.Model):
def get_context_values(self):
context = self.env.context
actual_company_id = context.get("company_id", self.env.company.id)
return (
context.get("from_date", fields.Date.context_today(self)),
context.get("to_date", fields.Date.context_today(self)),
context.get("company_ids", [self.env.user.company_id.id]),
context.get("company_ids", [actual_company_id]),
context.get("target_move", "posted"),
)

14
account_tax_balance/wizard/open_tax_balances.py

@ -8,8 +8,12 @@ class WizardOpenTaxBalances(models.TransientModel):
_name = "wizard.open.tax.balances"
_description = "Wizard Open Tax Balances"
company_id = fields.Many2one(
"res.company", required=True, default=lambda self: self.env.user.company_id
company_ids = fields.Many2many(
comodel_name="res.company",
string="Companies",
required=True,
domain=lambda self: [("id", "in", self.env.companies.ids)],
default=lambda self: self.env.companies.ids,
)
from_date = fields.Date(
required=True, store=True, readonly=False, compute="_compute_date_range"
@ -63,17 +67,17 @@ class WizardOpenTaxBalances(models.TransientModel):
"target": _(self.target_move),
"from": self.from_date.strftime(date_format),
"to": self.to_date.strftime(date_format),
"company": self.company_id.name,
}
# name of action which is displayed in breacrumb
vals["name"] = _("%(name)s: %(target)s from %(from)s to %(to)s") % infos
multi_cpny_grp = self.env.ref("base.group_multi_company")
if multi_cpny_grp in self.env.user.groups_id:
vals["name"] = "{} ({})".format(vals["name"], self.company_id.name)
company_names = self.company_ids.mapped("name")
vals["name"] = "{} ({})".format(vals["name"], ", ".join(company_names))
vals["context"] = {
"from_date": self.from_date,
"to_date": self.to_date,
"target_move": self.target_move,
"company_id": self.company_id.id,
"company_ids": self.company_ids.ids,
}
return vals

2
account_tax_balance/wizard/open_tax_balances_view.xml

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<form string="Taxes Balance">
<group>
<field name="company_id"/>
<field name="company_ids" widget="many2many_tags" groups="base.group_multi_company"/>
<field name="date_range_id"/>
<field name="from_date"></field>
<field name="to_date"></field>

Loading…
Cancel
Save