Skip to content
Snippets Groups Projects
Commit a7007748 authored by yhu-odoo's avatar yhu-odoo
Browse files

[ADD] project_purchase: Monitoring purchase in project

Show purchase information in project when both use the same analytic
account.

Task-2469742
PR #68708
parent f2422345
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': "Project Purchase",
'version': '1.0',
'summary': "Monitor purchase in project",
'description': "",
'category': 'Services/Project',
'depends': ['purchase', 'project'],
'data': [
'views/project_views.xml',
],
'application': False,
'auto_install': True,
'license': 'LGPL-3',
}
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import project
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class Project(models.Model):
_inherit = "project.project"
purchase_order_count = fields.Integer(related="analytic_account_id.purchase_order_count")
def action_view_purchase_orders(self):
self.ensure_one()
return self.analytic_account_id.action_view_purchase_orders()
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="project_project_form_view_inherited" model="ir.ui.view">
<field name="name">project.project.view.inherited</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project" />
<field name="priority">20</field>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_view_analytic_account_entries']" position="after">
<button class="oe_stat_button" type="object" name="action_view_purchase_orders"
icon="fa-shopping-cart" attrs="{'invisible': [('purchase_order_count', '=', 0)]}">
<field string="Purchase Orders" name="purchase_order_count" widget="statinfo"/>
</button>
</xpath>
</field>
</record>
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment