-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][ADD] Add module project_mrp (#287)
* [ADD] Add module project_Mrp * [ADD] Add module project_Mrp
- Loading branch information
Showing
10 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=========== | ||
Project MRP | ||
=========== | ||
|
||
* Add new field task_ids in mrp production. | ||
* Add new field mrp_production_id in project task. | ||
* Add new field product_id in project task. | ||
* Create a button in mrp production form to call action_view_related_tasks to show related tasks. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/sale-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
Contributors | ||
------------ | ||
|
||
* Ana Juaristi <[email protected]> | ||
* Unai Beristain <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Project MRP Integration", | ||
"version": "14.0.1.1.0", | ||
"category": "Project", | ||
"website": "https://github.com/avanzosc/project-addons", | ||
"license": "AGPL-3", | ||
"author": "AvanzOSC", | ||
"depends": ["base", "project", "mrp", "sale", "mrp_sale_info"], | ||
"data": [ | ||
"views/project_task_views.xml", | ||
"views/mrp_production_views.xml", | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import project_task, mrp_production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class MrpProduction(models.Model): | ||
_inherit = "mrp.production" | ||
|
||
task_ids = fields.One2many( | ||
"project.task", "mrp_production_id", string="Related Tasks" | ||
) | ||
|
||
def action_view_related_tasks(self): | ||
action = self.env.ref("project.action_view_task").read()[0] | ||
action["domain"] = [("id", "in", self.task_ids.ids)] | ||
action["context"] = { | ||
"default_project_id": self.project_id.id | ||
if hasattr(self, "project_id") and self.project_id | ||
else False, | ||
"default_mrp_production_id": self.id, | ||
} | ||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ProjectTask(models.Model): | ||
_inherit = "project.task" | ||
|
||
mrp_production_id = fields.Many2one( | ||
comodel_name="mrp.production", | ||
string="Manufacturing Order", | ||
) | ||
product_id = fields.Many2one( | ||
related="mrp_production_id.product_id", string="Product", store=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<record id="view_mrp_production_form_inherit" model="ir.ui.view"> | ||
<field name="name">mrp.production.form.inherit</field> | ||
<field name="model">mrp.production</field> | ||
<field name="inherit_id" ref="mrp.mrp_production_form_view" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook" position="inside"> | ||
<page string="Tasks"> | ||
<field name="task_ids"> | ||
<tree editable="bottom"> | ||
<field name="name" /> | ||
</tree> | ||
</field> | ||
</page> | ||
</xpath> | ||
<xpath expr="//div[@name='button_box']" position="inside"> | ||
<button | ||
name="action_view_related_tasks" | ||
type="object" | ||
string="Related Tasks" | ||
class="oe_highlight" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<record id="view_task_form_inherit" model="ir.ui.view"> | ||
<field name="name">project.task.form.inherit</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_form2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='partner_id']" position="after"> | ||
<field name="sale_order_id" invisible="1" /> | ||
<field | ||
name="mrp_production_id" | ||
domain="['|',('sale_id', '=', sale_order_id), ('sale_id', '=', False)]" | ||
/> | ||
<field name="product_id" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../project_mrp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |