mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP mrp_bom_version]
This commit is contained in:
@@ -19,34 +19,28 @@
|
||||
"name": "MRP BoM Version",
|
||||
"version": "1.0",
|
||||
"author": "OdooMRP team",
|
||||
"category": "MRP",
|
||||
"category": "Manufacturing",
|
||||
"website": "http://www.odoomrp.com",
|
||||
"description": """
|
||||
This module performs the following:
|
||||
|
||||
1.- In the MRP BoM list object, 3 new fields are added:
|
||||
1.- In the MRP BoM list object, 2 new fields are added:
|
||||
|
||||
1.1.- Review, of type integer, defined by hand. When saving the list
|
||||
verified that there is another with the same sequence.
|
||||
1.2.- Historical Date, of type date.
|
||||
1.3.- Status, of type selection, with these values: draft, in active
|
||||
1.1.- Historical Date, of type date.
|
||||
1.2.- Status, of type selection, with these values: draft, in active
|
||||
and historical. This new field has gotten because it has added a
|
||||
workflow to MRP BoM list object.
|
||||
|
||||
2.- In the MRP bom List object, a workflow is added, is this:
|
||||
|
||||
2.1.- Draft -> In Active -> Historical, and you can not go back.
|
||||
|
||||
You can only modify the components and / or production process if it is in
|
||||
draft status. The other fields can only be changed if they are not in
|
||||
historical state.
|
||||
when the MRP BoM list is put to active, a record of who has activated,
|
||||
and when will include in chatter/log.
|
||||
Also creates a constraint for the sequence field to be unique.
|
||||
""",
|
||||
"depends": ['mrp',
|
||||
],
|
||||
"data": ['data/mrp_bom_data.xml',
|
||||
'data/mrp_bom_workflow.xml',
|
||||
'views/mrp_bom_view.xml',
|
||||
],
|
||||
"installable": True
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="wkf_mrp_bom" model="workflow">
|
||||
<field name="name">mrp.bom.basic</field>
|
||||
<field name="osv">mrp.bom</field>
|
||||
<field name="on_create">True</field>
|
||||
</record>
|
||||
<record id="act_draft" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_mrp_bom"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="name">draft</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_draft()</field>
|
||||
</record>
|
||||
<record id="act_active" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_mrp_bom"/>
|
||||
<field name="name">active</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_active()</field>
|
||||
</record>
|
||||
<record id="act_historical" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_mrp_bom"/>
|
||||
<field name="flow_end">True</field>
|
||||
<field name="name">historical</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_historical()</field>
|
||||
</record>
|
||||
<record id="trans_draft_active" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_active"/>
|
||||
<field name="signal">button_active</field>
|
||||
</record>
|
||||
<record id="trans_active_historical" model="workflow.transition">
|
||||
<field name="act_from" ref="act_active"/>
|
||||
<field name="act_to" ref="act_historical"/>
|
||||
<field name="signal">button_historical</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-10-23 14:36+0000\n"
|
||||
"PO-Revision-Date: 2014-10-23 16:40+0100\n"
|
||||
"POT-Creation-Date: 2014-11-10 09:13+0000\n"
|
||||
"PO-Revision-Date: 2014-11-10 10:14+0100\n"
|
||||
"Last-Translator: Alfredo <alfredodelafuente@avanzosc.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -47,6 +47,12 @@ msgstr "Fecha historificación"
|
||||
msgid "In active"
|
||||
msgstr "En activo"
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: model:mail.message.subtype,description:mrp_bom_version.mt_active
|
||||
#: model:mail.message.subtype,name:mrp_bom_version.mt_active
|
||||
msgid "MRP BoM Active"
|
||||
msgstr "MRP BoM Active"
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: view:mrp.bom:mrp_bom_version.mrp_bom_tree_view
|
||||
msgid "MRP BoMs"
|
||||
@@ -62,11 +68,6 @@ msgstr "Órden de producción"
|
||||
msgid "Product"
|
||||
msgstr "Producto"
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: field:mrp.bom,review:0
|
||||
msgid "Review"
|
||||
msgstr "Revisión"
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
|
||||
msgid "State"
|
||||
@@ -78,10 +79,10 @@ msgid "Status"
|
||||
msgstr "Estatus"
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: code:addons/mrp_bom_version/models/mrp.py:49
|
||||
#: code:addons/mrp_bom_version/models/mrp.py:53
|
||||
#, python-format
|
||||
msgid "The version number must be unique"
|
||||
msgstr "El número de versión debe ser única"
|
||||
msgid "The sequence must be unique"
|
||||
msgstr "La secuencia debe ser única."
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
|
||||
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-10-23 14:35+0000\n"
|
||||
"PO-Revision-Date: 2014-10-23 14:35+0000\n"
|
||||
"POT-Creation-Date: 2014-11-10 09:13+0000\n"
|
||||
"PO-Revision-Date: 2014-11-10 09:13+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -47,6 +47,12 @@ msgstr ""
|
||||
msgid "In active"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: model:mail.message.subtype,description:mrp_bom_version.mt_active
|
||||
#: model:mail.message.subtype,name:mrp_bom_version.mt_active
|
||||
msgid "MRP BoM Active"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: view:mrp.bom:mrp_bom_version.mrp_bom_tree_view
|
||||
msgid "MRP BoMs"
|
||||
@@ -62,11 +68,6 @@ msgstr ""
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: field:mrp.bom,review:0
|
||||
msgid "Review"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
|
||||
msgid "State"
|
||||
@@ -78,9 +79,9 @@ msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
#: code:addons/mrp_bom_version/models/mrp.py:49
|
||||
#: code:addons/mrp_bom_version/models/mrp.py:53
|
||||
#, python-format
|
||||
msgid "The version number must be unique"
|
||||
msgid "The sequence must be unique"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_bom_version
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
from openerp import models, fields, api, exceptions, _
|
||||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||
import time
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
@@ -30,7 +28,6 @@ class MrpBom(models.Model):
|
||||
},
|
||||
}
|
||||
|
||||
review = fields.Integer(string='Review')
|
||||
historical_date = fields.Date(string='Historical Date', readonly=True)
|
||||
state = fields.Selection([('draft', 'Draft'),
|
||||
('active', 'Active'),
|
||||
@@ -39,9 +36,9 @@ class MrpBom(models.Model):
|
||||
default='draft', copy=False)
|
||||
|
||||
@api.one
|
||||
@api.constrains('review')
|
||||
def check_mrp_bom_version(self):
|
||||
domain = [('id', '!=', self.id), ('review', '=', self.review)]
|
||||
@api.constrains('sequence')
|
||||
def check_mrp_bom_sequence(self):
|
||||
domain = [('id', '!=', self.id), ('sequence', '=', self.sequence)]
|
||||
if self.product_tmpl_id:
|
||||
domain.append(('product_tmpl_id', '=', self.product_tmpl_id.id))
|
||||
else:
|
||||
@@ -53,25 +50,25 @@ class MrpBom(models.Model):
|
||||
found = self.search(domain)
|
||||
if found:
|
||||
raise exceptions.Warning(
|
||||
_('The version number must be unique'))
|
||||
_('The sequence must be unique'))
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default.update({'review': 0})
|
||||
bom_ids = self.search(cr, uid, [], order='sequence desc',
|
||||
context=context)
|
||||
bom = self.browse(cr, uid, bom_ids[0], context=context)
|
||||
maxseq = bom.sequence + 1
|
||||
default.update({'sequence': maxseq})
|
||||
return super(MrpBom, self).copy(cr, uid, id, default=default,
|
||||
context=context)
|
||||
|
||||
@api.multi
|
||||
def action_draft(self):
|
||||
return self.write({'state': 'draft'})
|
||||
|
||||
@api.multi
|
||||
def action_active(self):
|
||||
def button_active(self):
|
||||
return self.write({'state': 'active'})
|
||||
|
||||
@api.multi
|
||||
def action_historical(self):
|
||||
def button_historical(self):
|
||||
return self.write({'state': 'historical',
|
||||
'historical_date': fields.Date.today()})
|
||||
|
||||
@@ -98,12 +95,9 @@ class MrpProduction(models.Model):
|
||||
('product_tmpl_id', '=', product_tmpl_id)
|
||||
]
|
||||
domain = domain + ['|', ('date_start', '=', False),
|
||||
('date_start', '<=',
|
||||
time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
|
||||
('date_start', '<=', fields.Datetime.now()),
|
||||
'|', ('date_stop', '=', False),
|
||||
('date_stop', '>=',
|
||||
time.strftime(
|
||||
DEFAULT_SERVER_DATETIME_FORMAT))]
|
||||
('date_stop', '>=', fields.Datetime.now())]
|
||||
bom_ids = bom_obj.search(cr, uid, domain, context=context)
|
||||
bom_id = 0
|
||||
min_seq = 0
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<tree string="MRP BoMs">
|
||||
<field name="name"/>
|
||||
<field name="active" />
|
||||
<field name="review" />
|
||||
<field name="sequence" />
|
||||
<field name="state" />
|
||||
<field name="historical_date"/>
|
||||
</tree>
|
||||
@@ -21,68 +21,68 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/group" position="before">
|
||||
<header>
|
||||
<button name="button_active" states="draft" string="In active" class="oe_highlight" />
|
||||
<button name="button_historical" states="active" string="Historical" class="oe_highlight"/>
|
||||
<button name="button_active" type="object" string="In active" attrs="{'invisible':[('state','!=',False)]}" class="oe_highlight" />
|
||||
<button name="button_active" type="object" string="In active" attrs="{'invisible':[('state','!=','draft')]}" class="oe_highlight" />
|
||||
<button name="button_historical" type="object" string="Historical" attrs="{'invisible':[('state','!=','active')]}" class="oe_highlight" />
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" />
|
||||
</header>
|
||||
</xpath>
|
||||
<field name="company_id" position="after">
|
||||
<group colspan="2" col="4">
|
||||
<field name="review" attrs="{'readonly':[('state', '=', 'historical')]}" />
|
||||
<group colspan="2" >
|
||||
<field name="historical_date" />
|
||||
</group>
|
||||
</field>
|
||||
<field name="product_tmpl_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="product_id" position="attributes">
|
||||
<xpath expr="//form/group/group/field[@name='product_id']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="product_qty" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//form/group/group/div/field[@name='product_qty']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="product_uom" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//form/group/group/div/field[@name='product_uom']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
</xpath>
|
||||
<field name="routing_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '!=', 'draft')]}</attribute>
|
||||
</field>
|
||||
<field name="name" position="attributes">
|
||||
<xpath expr="//form/group/group/field[@name='name']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="code" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//form/group/group/field[@name='code']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="type" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//form/group/group/field[@name='type']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
</xpath>
|
||||
<field name="company_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="bom_line_ids" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '!=', 'draft')]}</attribute>
|
||||
</field>
|
||||
<field name="position" position="attributes">
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='position']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="sequence" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='sequence']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="active" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='active']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="date_start" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='date_start']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="date_stop" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='date_stop']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="product_rounding" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='product_rounding']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
<field name="product_efficiency" position="attributes">
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Properties']/group/group/field[@name='product_efficiency']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
</xpath>
|
||||
<field name="property_ids" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('state', '=', 'historical')]}</attribute>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user