Skip to content

Commit

Permalink
[MIG] mrp_subcontracting_purchase: Adapt to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 committed Oct 13, 2023
1 parent 89fd156 commit 0765765
Show file tree
Hide file tree
Showing 34 changed files with 2,145 additions and 42 deletions.
2 changes: 2 additions & 0 deletions mrp_subcontracting_purchase/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module is a backport from Odoo SA and as such, it is not included in the OCA CLA.
That means we do not have a copy of the copyright on it like all other OCA modules.
2 changes: 0 additions & 2 deletions mrp_subcontracting_purchase/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import models
21 changes: 15 additions & 6 deletions mrp_subcontracting_purchase/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

{
"name": "Purchase and Subcontracting Management",
"version": "14.0.1.0.0",
"category": "Manufacturing/Purchase",
"summary": """
This bridge module adds some smart buttons between Purchase and Subcontracting
""",
"author": "Odoo S.A., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"depends": ["mrp_subcontracting", "purchase"],
"version": "14.0.1.0.0",
"author": "Odoo S.A., Ooops, Cetmix, Odoo Community Association (OCA)",
"maintainers": ["dessanhemrayev", "CetmixGitDrone", "Volodiay622", "geomer198"],
"category": "Manufacturing/Purchase",
"depends": ["mrp_subcontracting", "purchase_mrp", "stock_dropshipping"],
"data": [
"data/mrp_subcontracting_dropshipping_data.xml",
"views/purchase_order_views.xml",
"views/stock_picking_views.xml",
],
"demo": [
"demo/0001_demo_product_category.xml",
"demo/0011_demo_stock_location.xml",
"demo/0002_demo_partner_subcontract.xml",
"demo/0003_demo_product_test_product.xml",
"demo/0005_demo_product_supplierinfo.xml",
"demo/0004_demo_bom_subcontract.xml",
"demo/0006_demo_stock_rules.xml",
],
"installable": True,
"auto_install": True,
"license": "LGPL-3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<odoo>
<data noupdate="1">
<record id="route_subcontracting_dropshipping" model='stock.location.route'>
<field name="name">Dropship Subcontractor on Order</field>
<field name="sequence">5</field>
<field name="company_id" />
<field name="product_selectable" eval="True" />
</record>

<function
model="res.company"
name="create_missing_subcontracting_dropshipping_rules"
/>

<function model="stock.warehouse" name="write">
<value
model="stock.warehouse"
eval="obj().env['stock.warehouse'].search([]).ids"
/>
<value eval="{'subcontracting_dropshipping_to_resupply': True}" />
</function>
</data>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<odoo>
<record id="product_category_subcontracting_product" model="product.category">
<field name="name">Subcontracting products</field>
</record>
</odoo>
15 changes: 15 additions & 0 deletions mrp_subcontracting_purchase/demo/0002_demo_partner_subcontract.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<record id="res_partner_subcontracting_1" model="res.partner">
<field name="name">Sub 1</field>
<field name="property_stock_subcontractor" ref="demo_stock_location_sub_1" />
</record>

<record id="res_partner_subcontracting_2" model="res.partner">
<field name="name">Sub 2</field>
<field name="property_stock_subcontractor" ref="demo_stock_location_sub_2" />
</record>

<record id="res_partner_subcontracting_vendor" model="res.partner">
<field name="name">Vendor</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<odoo>
<record id="demo_product_product_finished" model="product.product">
<field name="name">Finished</field>
<field name="type">product</field>
<field name="list_price">10</field>
<field name="taxes_id" eval="False" />
<field name="sale_ok" eval="False" />
<field name="categ_id" ref="product_category_subcontracting_product" />
<field
name="route_ids"
eval="[(6, 0,[ref('purchase_stock.route_warehouse0_buy')])]"
/>
</record>

<record id="demo_product_product_component" model="product.product">
<field name="name">Component</field>
<field name="type">product</field>
<field name="list_price">10</field>
<field name="taxes_id" eval="False" />
<field name="sale_ok" eval="False" />
<field name="categ_id" ref="product_category_subcontracting_product" />
<field
name="route_ids"
eval="[(6, 0,[ref('route_subcontracting_dropshipping')])]"
/>
</record>

<record id="demo_product_product_element" model="product.product">
<field name="name">Element</field>
<field name="type">product</field>
<field name="list_price">10</field>
<field name="taxes_id" eval="False" />
<field name="sale_ok" eval="False" />
<field name="categ_id" ref="product_category_subcontracting_product" />
<field
name="route_ids"
eval="[(6, 0,[ref('route_subcontracting_dropshipping')])]"
/>
</record>
</odoo>
58 changes: 58 additions & 0 deletions mrp_subcontracting_purchase/demo/0004_demo_bom_subcontract.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<odoo noupdate="1">
<record id="mrp_bom_subcontract_1" model="mrp.bom">
<field
name="product_tmpl_id"
ref="demo_product_product_finished_product_template"
/>
<field name="product_uom_id" ref="uom.product_uom_unit" />
<field name="type">subcontract</field>
<field
name="subcontractor_ids"
eval="[(6, 0,[ref('res_partner_subcontracting_1')] )]"
/>
<field name="sequence">1</field>
</record>

<record id="mrp_bom_subcontract_2" model="mrp.bom">
<field
name="product_tmpl_id"
ref="demo_product_product_component_product_template"
/>
<field name="product_uom_id" ref="uom.product_uom_unit" />
<field name="type">subcontract</field>
<field
name="subcontractor_ids"
eval="[(6, 0,[ref('res_partner_subcontracting_2')] )]"
/>
<field name="sequence">1</field>
</record>

<record id="mrp_bom_subcontract_1_manufacture_line_1" model="mrp.bom.line">
<field
name="product_id"
ref="mrp_subcontracting_purchase.demo_product_product_component"
/>
<field name="product_qty">1</field>
<field name="product_uom_id" ref="uom.product_uom_unit" />
<field name="sequence">5</field>
<field
name="bom_id"
ref="mrp_subcontracting_purchase.mrp_bom_subcontract_1"
/>
</record>

<record id="mrp_bom_subcontract_2_manufacture_line_1" model="mrp.bom.line">
<field
name="product_id"
ref="mrp_subcontracting_purchase.demo_product_product_element"
/>
<field name="product_qty">1</field>
<field name="product_uom_id" ref="uom.product_uom_unit" />
<field name="sequence">5</field>
<field
name="bom_id"
ref="mrp_subcontracting_purchase.mrp_bom_subcontract_2"
/>
</record>

</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>
<record id="product_supplierinfo_subcontract_1" model="product.supplierinfo">
<field
name="product_tmpl_id"
ref="demo_product_product_finished_product_template"
/>
<field name="price">10</field>
<field name="name" ref="res_partner_subcontracting_1" />
<field name="currency_id" ref="base.USD" />
</record>

<record id="product_supplierinfo_subcontract_2" model="product.supplierinfo">
<field
name="product_tmpl_id"
ref="demo_product_product_component_product_template"
/>
<field name="price">10</field>
<field name="name" ref="res_partner_subcontracting_2" />
<field name="currency_id" ref="base.USD" />
</record>

<record id="product_supplierinfo_subcontract_3" model="product.supplierinfo">
<field
name="product_tmpl_id"
ref="demo_product_product_element_product_template"
/>
<field name="price">10</field>
<field name="name" ref="res_partner_subcontracting_vendor" />
<field name="currency_id" ref="base.USD" />
</record>
</odoo>
68 changes: 68 additions & 0 deletions mrp_subcontracting_purchase/demo/0006_demo_stock_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>
<record id="demo_stock_rules_1" model="stock.rule">
<field name="name">Vendors — Sub 1</field>
<field name="action">buy</field>
<field name="location_id" ref="demo_stock_location_sub_1" />
<field name="route_id" ref="route_subcontracting_dropshipping" />
<field name="company_id" ref="base.main_company" />
<field
name="picking_type_id"
model="stock.picking.type"
eval="obj().with_context(active_test=False).search([('name','=','Dropship'),('sequence_code','=','DS'),('company_id','=',obj().env.company.id)],limit=1)"
/>
</record>

<record id="demo_stock_rules_2" model="stock.rule">
<field name="name">Vendors — Sub 2</field>
<field name="action">buy</field>
<field name="location_id" ref="demo_stock_location_sub_2" />
<field name="route_id" ref="route_subcontracting_dropshipping" />
<field name="company_id" ref="base.main_company" />
<field
name="picking_type_id"
model="stock.picking.type"
eval="obj().with_context(active_test=False).search([('name','=','Dropship'),('sequence_code','=','DS'),('company_id','=',obj().env.company.id)],limit=1)"
/>
</record>

<record id="demo_stock_rules_3" model="stock.rule">
<field name="name">Sub 1 — Production</field>
<field name="action">pull</field>
<field
name="picking_type_id"
model="stock.picking.type"
eval="obj().with_context(active_test=False).search([('name','=','Subcontracting'),('sequence_code','=','SBC')],limit=1)"
/>
<field name="location_src_id" ref="demo_stock_location_sub_1" />
<field
name="location_id"
model="stock.location"
eval="obj().search([('name','=','Production')],limit=1)"
/>
<field name="route_id" ref="route_subcontracting_dropshipping" />
<field name="warehouse_id" ref="stock.warehouse0" />
<field name="procure_method">make_to_order</field>
<field name="partner_address_id" ref="res_partner_subcontracting_1" />
</record>

<record id="demo_stock_rules_4" model="stock.rule">
<field name="name">Sub 2 — Production</field>
<field name="action">pull</field>
<field
name="picking_type_id"
model="stock.picking.type"
eval="obj().with_context(active_test=False).search([('name','=','Subcontracting'),('sequence_code','=','SBC')],limit=1)"
/>
<field name="location_src_id" ref="demo_stock_location_sub_2" />
<field
name="location_id"
model="stock.location"
eval="obj().search([('name','=','Production')],limit=1)"
/>
<field name="route_id" ref="route_subcontracting_dropshipping" />
<field name="warehouse_id" ref="stock.warehouse0" />
<field name="procure_method">make_to_order</field>
<field name="partner_address_id" ref="res_partner_subcontracting_2" />
</record>
</odoo>
21 changes: 21 additions & 0 deletions mrp_subcontracting_purchase/demo/0011_demo_stock_location.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>
<record id="demo_stock_location_sub_1" model="stock.location">
<field name="name">sub1</field>
<field
name="location_id"
model="stock.location"
eval="obj().with_context(active_test=False).search([('name','=','Subcontracting Location'),('company_id','=',obj().env.company.id)],limit=1)"
/>
<field name="company_id" ref="base.main_company" />
</record>
<record id="demo_stock_location_sub_2" model="stock.location">
<field name="name">sub2</field>
<field
name="location_id"
model="stock.location"
eval="obj().with_context(active_test=False).search([('name','=','Subcontracting Location'),('company_id','=',obj().env.company.id)],limit=1)"
/>
<field name="company_id" ref="base.main_company" />
</record>
</odoo>
Empty file.
6 changes: 6 additions & 0 deletions mrp_subcontracting_purchase/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import stock_move
from . import stock_warehouse
from . import stock_picking
from . import stock_rule
from . import purchase_order
from . import purchase_order_line
from . import res_company
from . import mrp_production
Loading

0 comments on commit 0765765

Please sign in to comment.