mirror of
https://github.com/bringout/oca-mrp.git
synced 2026-04-26 18:12:06 +02:00
Initial commit: OCA Mrp packages (117 packages)
This commit is contained in:
commit
277e84fd7a
4403 changed files with 395154 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import mrp_production
|
||||
from . import mrp_workorder
|
||||
from . import stock_rule
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
|
||||
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
|
||||
# Copyright 2020 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = "mrp.production"
|
||||
|
||||
source_procurement_group_id = fields.Many2one(
|
||||
comodel_name="procurement.group",
|
||||
readonly=True,
|
||||
)
|
||||
sale_id = fields.Many2one(
|
||||
comodel_name="sale.order",
|
||||
string="Sale order",
|
||||
readonly=True,
|
||||
store=True,
|
||||
related="source_procurement_group_id.sale_id",
|
||||
)
|
||||
partner_id = fields.Many2one(
|
||||
comodel_name="res.partner",
|
||||
related="sale_id.partner_id",
|
||||
string="Customer",
|
||||
store=True,
|
||||
)
|
||||
commitment_date = fields.Datetime(
|
||||
related="sale_id.commitment_date", string="Commitment Date", store=True
|
||||
)
|
||||
client_order_ref = fields.Char(
|
||||
related="sale_id.client_order_ref", string="Customer Reference", store=True
|
||||
)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
|
||||
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MrpWorkorder(models.Model):
|
||||
_inherit = "mrp.workorder"
|
||||
|
||||
sale_id = fields.Many2one(
|
||||
related="production_id.sale_id", string="Sale order", readonly=True, store=True
|
||||
)
|
||||
partner_id = fields.Many2one(
|
||||
related="sale_id.partner_id", readonly=True, string="Customer", store=True
|
||||
)
|
||||
commitment_date = fields.Datetime(
|
||||
related="sale_id.commitment_date",
|
||||
string="Commitment Date",
|
||||
store=True,
|
||||
readonly=True,
|
||||
)
|
||||
client_order_ref = fields.Char(
|
||||
related="sale_id.client_order_ref", string="Customer Reference", store=True
|
||||
)
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
|
||||
# Copyright 2020 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
_inherit = "stock.rule"
|
||||
|
||||
def _prepare_mo_vals(
|
||||
self,
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
bom,
|
||||
):
|
||||
res = super()._prepare_mo_vals(
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
bom,
|
||||
)
|
||||
res["source_procurement_group_id"] = (
|
||||
values.get("group_id").id if values.get("group_id", False) else False
|
||||
)
|
||||
return res
|
||||
Loading…
Add table
Add a link
Reference in a new issue