mirror of
https://github.com/bringout/oca-ocb-mrp.git
synced 2026-04-24 14:12:02 +02:00
Initial commit: Mrp packages
This commit is contained in:
commit
50d736b3bd
739 changed files with 538193 additions and 0 deletions
43
odoo-bringout-oca-ocb-mrp/mrp/models/res_company.py
Normal file
43
odoo-bringout-oca-ocb-mrp/mrp/models/res_company.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class Company(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
manufacturing_lead = fields.Float(
|
||||
'Manufacturing Lead Time', default=0.0, required=True,
|
||||
help="Security days for each manufacturing operation.")
|
||||
|
||||
def _create_unbuild_sequence(self):
|
||||
unbuild_vals = []
|
||||
for company in self:
|
||||
unbuild_vals.append({
|
||||
'name': 'Unbuild',
|
||||
'code': 'mrp.unbuild',
|
||||
'company_id': company.id,
|
||||
'prefix': 'UB/',
|
||||
'padding': 5,
|
||||
'number_next': 1,
|
||||
'number_increment': 1
|
||||
})
|
||||
if unbuild_vals:
|
||||
self.env['ir.sequence'].create(unbuild_vals)
|
||||
|
||||
@api.model
|
||||
def create_missing_unbuild_sequences(self):
|
||||
company_ids = self.env['res.company'].search([])
|
||||
company_has_unbuild_seq = self.env['ir.sequence'].search([('code', '=', 'mrp.unbuild')]).mapped('company_id')
|
||||
company_todo_sequence = company_ids - company_has_unbuild_seq
|
||||
company_todo_sequence._create_unbuild_sequence()
|
||||
|
||||
def _create_per_company_sequences(self):
|
||||
super(Company, self)._create_per_company_sequences()
|
||||
self._create_unbuild_sequence()
|
||||
|
||||
def _get_security_by_rule_action(self):
|
||||
res = super()._get_security_by_rule_action()
|
||||
res['manufacture'] = self.manufacturing_lead
|
||||
return res
|
||||
Loading…
Add table
Add a link
Reference in a new issue