[UPD] Add button to list draft invoice lines linked to budget line
This commit is contained in:
@@ -418,3 +418,24 @@ class BudgetForecast(models.Model):
|
|||||||
return action
|
return action
|
||||||
else:
|
else:
|
||||||
raise UserError(_("There is no analytic lines linked to this budget line"))
|
raise UserError(_("There is no analytic lines linked to this budget line"))
|
||||||
|
|
||||||
|
def action_view_draft_invoice_lines(self):
|
||||||
|
self.ensure_one()
|
||||||
|
invoice_lines = (
|
||||||
|
self.env["account.move.line"]
|
||||||
|
.search([("parent_state", "in", ["draft"])])
|
||||||
|
.filtered(lambda x: self.analytic_tag in x.analytic_tag_ids)
|
||||||
|
)
|
||||||
|
if len(invoice_lines) > 0:
|
||||||
|
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||||
|
"account.action_account_moves_all_tree"
|
||||||
|
)
|
||||||
|
action["domain"] = [
|
||||||
|
("analytic_tag_ids", "ilike", self.analytic_tag.id),
|
||||||
|
("parent_state", "in", ["draft"]),
|
||||||
|
]
|
||||||
|
return action
|
||||||
|
else:
|
||||||
|
raise UserError(
|
||||||
|
_("There is no draft invoice lines linked to this budget line")
|
||||||
|
)
|
||||||
|
@@ -36,10 +36,17 @@
|
|||||||
<field name="actual_amount" />
|
<field name="actual_amount" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="Analytic Lines">
|
<group string="Expenses and Incomes lists">
|
||||||
<button class="oe_highlight" type="object" name="action_view_analytic_lines">
|
<group string="Analytic Lines">
|
||||||
Consult analytics lines
|
<button class="oe_highlight" type="object" name="action_view_analytic_lines">
|
||||||
</button>
|
List analytics lines
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
|
<group string="Draft invoice lines">
|
||||||
|
<button class="oe_highlight" type="object" name="action_view_draft_invoice_lines">
|
||||||
|
List draft invoce lines
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="Childs" attrs="{'invisible' : [('child_ids','=', False)]}">
|
<group string="Childs" attrs="{'invisible' : [('child_ids','=', False)]}">
|
||||||
<field name="child_ids" nolabel="1">
|
<field name="child_ids" nolabel="1">
|
||||||
|
Reference in New Issue
Block a user