parent
69cc563809
commit
cff5d130d1
|
@ -543,16 +543,21 @@ class mrp_production(osv.osv):
|
|||
return {'value': {'location_dest_id': src}}
|
||||
return {}
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product):
|
||||
def product_id_change(self, cr, uid, ids, product, context=None):
|
||||
""" Finds UoM of changed product.
|
||||
@param product: Id of changed product.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if not product:
|
||||
return {}
|
||||
res = self.pool.get('product.product').read(cr, uid, [product], ['uom_id'])[0]
|
||||
uom = res['uom_id'] and res['uom_id'][0]
|
||||
result = {'product_uom': uom}
|
||||
return {'value': {
|
||||
'product_uom': False,
|
||||
'bom_id': False
|
||||
}}
|
||||
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||
result = {
|
||||
'product_uom': res.uom_id and res.uom_id.id or False,
|
||||
'bom_id': res.bom_ids and res.bom_ids[0].id or False
|
||||
}
|
||||
return {'value': result}
|
||||
|
||||
def bom_id_change(self, cr, uid, ids, product):
|
||||
|
|
|
@ -19,7 +19,5 @@
|
|||
##############################################################################
|
||||
|
||||
import product_expiry
|
||||
import wizard
|
||||
import report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
- removal date
|
||||
- alert date
|
||||
Used, for example, in food industries.''',
|
||||
"update_xml" : ["product_expiry_view.xml", "report/report_stock_view.xml", "wizard/stock_partial_view.xml"],
|
||||
"update_xml" : ["product_expiry_view.xml"],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
|
@ -8,13 +8,13 @@ msgstr ""
|
|||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-06-30 15:09+0000\n"
|
||||
"PO-Revision-Date: 2010-06-21 15:56+0000\n"
|
||||
"PO-Revision-Date: 2010-01-10 22:56+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Catalan <ca@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-06-22 04:20+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-24 04:01+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: product_expiry
|
||||
|
@ -161,3 +161,20 @@ msgstr ""
|
|||
#: field:product.product,alert_time:0
|
||||
msgid "Product alert time"
|
||||
msgstr "Data alerta producte"
|
||||
|
||||
#~ msgid "Alert date"
|
||||
#~ msgstr "Data alarma"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Track different dates on products and lots. Used, for exampel, in food "
|
||||
#~ "industries: expiry date, alert date, date of removal, eso."
|
||||
#~ msgstr ""
|
||||
#~ "Gestiona diferents dates per a productes i lots. Utilitzat, per exemple, en "
|
||||
#~ "la indústria alimentària: Data de caducitat, data d'alarma, data "
|
||||
#~ "d'eliminació, ..."
|
||||
|
||||
#~ msgid "DLUO"
|
||||
#~ msgstr "Data caducitat"
|
||||
|
||||
#~ msgid "Removal date"
|
||||
#~ msgstr "Data eliminació"
|
||||
|
|
|
@ -8,13 +8,13 @@ msgstr ""
|
|||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-06-30 15:09+0000\n"
|
||||
"PO-Revision-Date: 2010-06-21 15:56+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"PO-Revision-Date: 2010-04-29 04:43+0000\n"
|
||||
"Last-Translator: Rhubeni Lopes de Andrade <rhube.itsasecret@gmail.com>\n"
|
||||
"Language-Team: Spanish <es@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-06-22 04:20+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-30 03:57+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: product_expiry
|
||||
|
@ -161,3 +161,20 @@ msgstr ""
|
|||
#: field:product.product,alert_time:0
|
||||
msgid "Product alert time"
|
||||
msgstr "Fecha alerta producto"
|
||||
|
||||
#~ msgid "Alert date"
|
||||
#~ msgstr "Fecha alarma"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Track different dates on products and lots. Used, for exampel, in food "
|
||||
#~ "industries: expiry date, alert date, date of removal, eso."
|
||||
#~ msgstr ""
|
||||
#~ "Gestiona distintas fechas para productos y lotes. Utilizado, por ejemplo, en "
|
||||
#~ "industria alimentaria: Fecha de caducidad, fecha de alarma, fecha de "
|
||||
#~ "eliminación, ..."
|
||||
|
||||
#~ msgid "DLUO"
|
||||
#~ msgstr "Fecha caducidad"
|
||||
|
||||
#~ msgid "Removal date"
|
||||
#~ msgstr "Fecha eliminación"
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
# French translation for openobject-addons
|
||||
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_expiry
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Project-Id-Version: OpenERP Server 5.0.1\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-06-30 15:09+0000\n"
|
||||
"PO-Revision-Date: 2010-06-21 15:56+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: French <fr@li.org>\n"
|
||||
"PO-Revision-Date: 2010-01-04 18:19+0000\n"
|
||||
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-06-22 04:20+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-24 04:01+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: product_expiry
|
||||
|
|
|
@ -21,21 +21,10 @@
|
|||
import datetime
|
||||
from osv import fields, osv
|
||||
import pooler
|
||||
import time
|
||||
|
||||
class stock_production_lot(osv.osv):
|
||||
_name = 'stock.production.lot'
|
||||
_inherit = 'stock.production.lot'
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
result = []
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
if line.life_date:
|
||||
result.append((line.id, (line.name or '')+' ('+line.life_date+')'))
|
||||
else:
|
||||
result.append((line.id, line.name))
|
||||
return result
|
||||
|
||||
def _get_date(dtype):
|
||||
"""Return a function to compute the limit date for this type"""
|
||||
|
@ -52,24 +41,36 @@ class stock_production_lot(osv.osv):
|
|||
# set date to False when no expiry time specified on the product
|
||||
date = duration and (datetime.datetime.today()
|
||||
+ datetime.timedelta(days=duration))
|
||||
return date and date.strftime('%Y-%m-%d')
|
||||
return date and date.strftime('%Y-%m-%d %H:%M:%S')
|
||||
return calc_date
|
||||
|
||||
_columns = {
|
||||
'life_date': fields.date('End of Life Date',
|
||||
'life_date': fields.datetime('End of Life Date',
|
||||
help='The date the lot may become dangerous and should not be consumed.'),
|
||||
'use_date': fields.date('Best before Date',
|
||||
'use_date': fields.datetime('Best before Date',
|
||||
help='The date the lot starts deteriorating without becoming dangerous.'),
|
||||
'removal_date': fields.date('Removal Date',
|
||||
'removal_date': fields.datetime('Removal Date',
|
||||
help='The date the lot should be removed.'),
|
||||
'alert_date': fields.date('Alert Date'),
|
||||
'alert_date': fields.datetime('Alert Date'),
|
||||
}
|
||||
# Assign dates according to products data
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
newid = super(stock_production_lot, self).create(cr, uid, vals, context=context)
|
||||
obj = self.browse(cr, uid, newid, context=context)
|
||||
towrite = []
|
||||
for f in ('life_date','use_date','removal_date','alert_date'):
|
||||
if not getattr(obj, f):
|
||||
towrite.append(f)
|
||||
context = context or {}
|
||||
context['product_id'] = obj.product_id.id
|
||||
self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context))
|
||||
return newid
|
||||
|
||||
_defaults = {
|
||||
# 'life_date': _get_date('life_time'),
|
||||
# 'use_date': _get_date('use_time'),
|
||||
# 'removal_date': _get_date('removal_time'),
|
||||
# 'alert_date': _get_date('alert_time'),
|
||||
'life_date': _get_date('life_time'),
|
||||
'use_date': _get_date('use_time'),
|
||||
'removal_date': _get_date('removal_time'),
|
||||
'alert_date': _get_date('alert_time'),
|
||||
}
|
||||
stock_production_lot()
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import report_stock
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
import tools
|
||||
from tools.sql import drop_view_if_exists
|
||||
|
||||
class stock_report_prodlots(osv.osv):
|
||||
_name = "stock.report.prodlots1"
|
||||
_description = "Stock report by production lots"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.float('Quantity', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Location', readonly=True, select=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Production lot', readonly=True, select=True),
|
||||
'life_date': fields.date('End of Life Date',
|
||||
help='The date the lot may become dangerous and should not be consumed.'),
|
||||
'use_date': fields.date('Best before Date',
|
||||
help='The date the lot starts deteriorating without becoming dangerous.'),
|
||||
'removal_date': fields.date('Removal Date',
|
||||
help='The date the lot should be removed.'),
|
||||
'alert_date': fields.date('Alert Date'),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
drop_view_if_exists(cr, 'stock_report_prodlots1')
|
||||
cr.execute("""
|
||||
create or replace view stock_report_prodlots1 as (
|
||||
select max(id) as id,
|
||||
location_id,
|
||||
product_id,
|
||||
prodlot_id,
|
||||
life_date,
|
||||
use_date,
|
||||
removal_date,
|
||||
alert_date,
|
||||
sum(qty) as name
|
||||
from (
|
||||
select -max(sm.id) as id,
|
||||
sm.location_id,
|
||||
sm.product_id,
|
||||
sm.prodlot_id,
|
||||
spl.life_date,
|
||||
spl.use_date,
|
||||
spl.removal_date,
|
||||
spl.alert_date,
|
||||
-sum(sm.product_qty /uo.factor) as qty
|
||||
from stock_move as sm
|
||||
left join stock_location sl
|
||||
on (sl.id = sm.location_id)
|
||||
left join stock_production_lot spl
|
||||
on (sm.prodlot_id=spl.id)
|
||||
left join product_uom uo
|
||||
on (uo.id=sm.product_uom)
|
||||
where state = 'done'
|
||||
group by sm.location_id, sm.product_id, sm.product_uom, sm.prodlot_id,
|
||||
spl.life_date,
|
||||
spl.use_date,
|
||||
spl.removal_date,
|
||||
spl.alert_date
|
||||
|
||||
union all
|
||||
select max(sm.id) as id,
|
||||
sm.location_dest_id as location_id,
|
||||
sm.product_id,
|
||||
sm.prodlot_id,
|
||||
spl.life_date,
|
||||
spl.use_date,
|
||||
spl.removal_date,
|
||||
spl.alert_date,
|
||||
sum(sm.product_qty /uo.factor) as qty
|
||||
from stock_move as sm
|
||||
left join stock_location sl
|
||||
on (sl.id = sm.location_dest_id)
|
||||
left join stock_production_lot spl
|
||||
on (sm.prodlot_id=spl.id)
|
||||
left join product_uom uo
|
||||
on (uo.id=sm.product_uom)
|
||||
where sm.state = 'done'
|
||||
group by sm.location_dest_id, sm.product_id, sm.product_uom, sm.prodlot_id,
|
||||
spl.life_date,
|
||||
spl.use_date,
|
||||
spl.removal_date,
|
||||
spl.alert_date
|
||||
|
||||
) as report
|
||||
group by location_id, product_id, prodlot_id,
|
||||
life_date,
|
||||
use_date,
|
||||
removal_date,
|
||||
alert_date
|
||||
)""")
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}):
|
||||
raise osv.except_osv(_('Error !'), _('You cannot delete any record!'))
|
||||
|
||||
|
||||
stock_report_prodlots()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,103 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_report_prodlots_filter" model="ir.ui.view">
|
||||
<field name="name">stock.report.prodlots.filter</field>
|
||||
<field name="model">stock.report.prodlots1</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Location">
|
||||
<group col="10" colspan="4">
|
||||
<filter icon="terp-go-home" name="internal_locations" string="Internal Locations" domain="[('location_id.usage', '=', 'internal')]" help="Internal Locations"/>
|
||||
<filter icon="terp-go-home" string="Customer Locations" domain="[('location_id.usage', '=', 'customer')]" help="Customer Locations" />
|
||||
<filter icon="terp-go-home" string="Supplier Locations" domain="[('location_id.usage', '=', 'supplier')]" help="Supplier Locations" />
|
||||
<separator orientation="vertical"/>
|
||||
<field name="location_id"/>
|
||||
<field name="product_id"/>
|
||||
<newline/>
|
||||
<field name="use_date" />
|
||||
<field name="life_date" string="End of Life" />
|
||||
<field name="alert_date" />
|
||||
<field name="removal_date" string="Removal D." />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Location" icon="terp-go-home" domain="[]" context="{'group_by':'location_id'}"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="stock_report_prodlots_form" model="ir.ui.view">
|
||||
<field name="name">stock.report.prodlots.view</field>
|
||||
<field name="model">stock.report.prodlots1</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stock by Lots">
|
||||
<field name="location_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<field name="name"/>
|
||||
<field name="use_date" />
|
||||
<field name="life_date" string="End of Life" />
|
||||
<field name="alert_date" />
|
||||
<field name="removal_date" string="Removal D." />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_report_prodlots_tree" model="ir.ui.view">
|
||||
<field name="name">stock.report.prodlots.view</field>
|
||||
<field name="model">stock.report.prodlots1</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock by Lots">
|
||||
<field name="location_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<field name="name"/>
|
||||
<field name="use_date" />
|
||||
<field name="life_date" string="End of Life" />
|
||||
<field name="alert_date" />
|
||||
<field name="removal_date" string="Removal D." />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_report_prodlots_graph" model="ir.ui.view">
|
||||
<field name="name">stock.report.prodlots.view</field>
|
||||
<field name="model">stock.report.prodlots1</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Stock by Lots" type="bar">
|
||||
<field name="product_id"/>
|
||||
<field name="name"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="stock.action_stock_report_prodlots_form" model="ir.actions.act_window">
|
||||
<field name="name">Inventory by Location</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.report.prodlots1</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'full':'1','search_default_internal_locations':1}</field>
|
||||
<field name="search_view_id" ref="view_stock_report_prodlots_filter" />
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
domain="[('product_id','=',active_id)]"
|
||||
id="stock.act_product_product_2_stock_report_prodlots"
|
||||
name="Stock by Lots"
|
||||
res_model="stock.report.prodlots1"
|
||||
src_model="product.product"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1 +0,0 @@
|
|||
import stock_partial
|
|
@ -1,70 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
from tools.misc import UpdateableStr, UpdateableDict
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
import pooler
|
||||
import time
|
||||
import datetime, time
|
||||
import wizard
|
||||
|
||||
class stock_production_lot(osv.osv):
|
||||
_inherit = "stock.production.lot"
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
new_id = super(stock_production_lot, self).create(cr, uid, vals, context=context)
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
prod = prodlot_obj.browse(cr, uid, new_id, context=context)
|
||||
res = {}
|
||||
current_date = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
if not prod.life_date:
|
||||
date_life = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.life_time))
|
||||
res['life_date'] = date_life.strftime('%Y-%m-%d')
|
||||
if not prod.use_date:
|
||||
date_use = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.use_time))
|
||||
res['use_date'] = date_use.strftime('%Y-%m-%d')
|
||||
if not prod.removal_date:
|
||||
date_removal = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.removal_time))
|
||||
res['removal_date'] = date_removal.strftime('%Y-%m-%d')
|
||||
if not prod.alert_date:
|
||||
date_alert = (datetime.datetime.strptime(current_date, '%Y-%m-%d %H:%M:%S') + datetime.timedelta(days=prod.product_id.alert_time))
|
||||
res['alert_date'] = date_alert.strftime('%Y-%m-%d')
|
||||
prodlot_obj.write(cr, uid, [prod.id], res)
|
||||
return new_id
|
||||
stock_production_lot()
|
||||
|
||||
class stock_move_split_lines_exist(osv.osv_memory):
|
||||
_inherit = "stock.move.split.lines"
|
||||
_columns = {
|
||||
'date': fields.date('Expiry Date'),
|
||||
}
|
||||
# TODO: use this date instead of default one
|
||||
def on_change_product(self, cr, uid, ids, product_id):
|
||||
if not product_id:
|
||||
return {'value':{'date': False}}
|
||||
day_life = self.pool.get('product.product').browse(cr, uid, product_id).life_time
|
||||
date_life = (datetime.datetime.now() + datetime.timedelta(days=day_life))
|
||||
return {'value':
|
||||
{'date': date_life.strftime('%Y-%m-%d')}
|
||||
}
|
||||
stock_move_split_lines_exist()
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_split_in_lots" model="ir.ui.view">
|
||||
<field name="name">Split in lots</field>
|
||||
<field name="model">stock.move.split</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="stock.view_split_in_lots"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//form/group/field[@name='line_ids']/tree/field[@name='name']" position="replace">
|
||||
<field name="name" on_change="on_change_product(parent.product_id)"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/group/field[@name='line_ids']/tree/field[@name='quantity']" position="after">
|
||||
<field name="date"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -21,7 +21,7 @@
|
|||
"name" : "Products Attributes & Manufacturers",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"category" : "Enterprise Specific Modules/Industries",
|
||||
"category" : "Enterprise Specific Modules/Manufacturer Industries",
|
||||
"depends" : ["base", "account", "product", "stock"],
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_electronic
|
||||
# * product_manufacturer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
@ -15,88 +15,88 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.module.module,description:product_electronic.module_meta_information
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.module.module,description:product_manufacturer.module_meta_information
|
||||
msgid "A module that add manufacturers and attributes on the product form"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer_pref:0
|
||||
msgid "Manufacturer product code"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: view:product.electronic.attribute:0
|
||||
#. module: product_manufacturer
|
||||
#: view:product.manufacturer.attribute:0
|
||||
msgid "Product Template Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.model,name:product_electronic.model_product_electronic_attribute
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.model,name:product_manufacturer.model_product_electronic_attribute
|
||||
msgid "Product attributes"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Manufacturing data"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Product reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,name:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,name:0
|
||||
msgid "Attribute"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,product_id:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,product_id:0
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,value:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,value:0
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Manufacturing Data"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Product name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
#: field:product.product,attribute_ids:0
|
||||
msgid "Attributes"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.module.module,shortdesc:product_electronic.module_meta_information
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.module.module,shortdesc:product_manufacturer.module_meta_information
|
||||
msgid "Products Attributes & Manufacturers"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer_pname:0
|
||||
msgid "Manufacturer product name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer:0
|
||||
msgid "Manufacturer"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_electronic
|
||||
# * product_manufacturer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
@ -15,88 +15,88 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.module.module,description:product_electronic.module_meta_information
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.module.module,description:product_manufacturer.module_meta_information
|
||||
msgid "A module that add manufacturers and attributes on the product form"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer_pref:0
|
||||
msgid "Manufacturer product code"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: view:product.electronic.attribute:0
|
||||
#. module: product_manufacturer
|
||||
#: view:product.manufacturer.attribute:0
|
||||
msgid "Product Template Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.model,name:product_electronic.model_product_electronic_attribute
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.model,name:product_manufacturer.model_product_electronic_attribute
|
||||
msgid "Product attributes"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Manufacturing data"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Product reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,name:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,name:0
|
||||
msgid "Attribute"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,product_id:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,product_id:0
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: field:product.electronic.attribute,value:0
|
||||
#. module: product_manufacturer
|
||||
#: field:product.manufacturer.attribute,value:0
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Manufacturing Data"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
msgid "Product name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: view:product.product:0
|
||||
#: field:product.product,attribute_ids:0
|
||||
msgid "Attributes"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#: model:ir.module.module,shortdesc:product_electronic.module_meta_information
|
||||
#. module: product_manufacturer
|
||||
#: model:ir.module.module,shortdesc:product_manufacturer.module_meta_information
|
||||
msgid "Products Attributes & Manufacturers"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer_pname:0
|
||||
msgid "Manufacturer product name"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_electronic
|
||||
#. module: product_manufacturer
|
||||
#: field:product.product,manufacturer:0
|
||||
msgid "Manufacturer"
|
||||
msgstr ""
|
|
@ -24,26 +24,13 @@ class product_product(osv.osv):
|
|||
_inherit = 'product.product'
|
||||
_name = 'product.product'
|
||||
_columns = {
|
||||
'manufacturer' : fields.many2one('res.partner', 'Manufacturer'),
|
||||
'manufacturer_pname' : fields.char('Manufacturer Product Name', size=64),
|
||||
'manufacturer_pref' : fields.char('Manufacturer Product Code', size=64),
|
||||
'attribute_ids': fields.one2many('product.manufacturer.attribute', 'product_id', 'Attributes'),
|
||||
'manufacturer_ids': fields.one2many('res.partner.manufacturer', 'product_id', 'Manufacturers'),
|
||||
}
|
||||
product_product()
|
||||
|
||||
class res_partner_manufacturer(osv.osv):
|
||||
_name = 'res.partner.manufacturer'
|
||||
_rec_name = 'manufacturer_id'
|
||||
_columns = {
|
||||
'manufacturer_id' : fields.many2one('res.partner', 'Manufacturer'),
|
||||
'country_id' : fields.many2one('res.country', 'Country'),
|
||||
'authorized' : fields.boolean('Authorized'),
|
||||
'product_id': fields.many2one('product.product', 'Product', ondelete='cascade'),
|
||||
}
|
||||
_defaults = {
|
||||
'authorized': lambda *a: True,
|
||||
}
|
||||
|
||||
res_partner_manufacturer()
|
||||
|
||||
class product_attribute(osv.osv):
|
||||
_name = "product.manufacturer.attribute"
|
||||
_description = "Product attributes"
|
||||
|
|
|
@ -9,12 +9,20 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Manufacturing Data">
|
||||
<separator string="Manufacturing data" colspan="4" />
|
||||
<field name="manufacturer_ids" colspan="4" nolabel="1" widget="one2many_list"/>
|
||||
<page string="Manufacturer">
|
||||
<separator string="Manufacturer" colspan="4" />
|
||||
<field name="manufacturer" />
|
||||
<newline/>
|
||||
<field name="manufacturer_pname"/>
|
||||
<field name="manufacturer_pref"/>
|
||||
|
||||
<separator string="Attributes" colspan="4"/>
|
||||
<field name="attribute_ids" colspan="4" nolabel="1" widget="one2many_list" />
|
||||
<field name="attribute_ids" colspan="4" nolabel="1">
|
||||
<tree string="Product Attributes" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="value"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
|
@ -25,7 +33,7 @@
|
|||
<field name="model">product.manufacturer.attribute</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product Template Name">
|
||||
<tree string="Product Attributes" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="value"/>
|
||||
</tree>
|
||||
|
@ -37,36 +45,12 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product Template Name">
|
||||
<field name="name" select="1"/>
|
||||
<field name="value" select="1"/>
|
||||
<field name="name"/>
|
||||
<field name="value"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="product_manufacturer_manufact_tree_view">
|
||||
<field name="name">res.partner.manufacturer.tree</field>
|
||||
<field name="model">res.partner.manufacturer</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Manufacturers" editable="top">
|
||||
<field name="manufacturer_id"/>
|
||||
<field name="country_id"/>
|
||||
<field name="authorized"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="product_manufacturer_manufa_form_view">
|
||||
<field name="name">res.partner.manufacturer.form</field>
|
||||
<field name="model">res.partner.manufacturer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Manufacturers">
|
||||
<field name="manufacturer_id" colspan="4"/>
|
||||
<field name="country_id"/>
|
||||
<field name="authorized"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute",,1,0,0,0
|
||||
"access_product_manufacturer_attribute","product.manufacturer.attribute","model_product_manufacturer_attribute",base.group_user,1,0,0,0
|
||||
"access_product_manufacturer_attribute_manager","product.manufacturer.attribute","model_product_manufacturer_attribute","product.group_product_manager",1,1,1,1
|
||||
"access_partner_manufacturer","res.partner.manufacturer","model_res_partner_manufacturer",,1,0,0,0
|
||||
"access_partner_manufacturer_manager","res.partner.manufacturer","model_res_partner_manufacturer","product.group_product_manager",1,1,1,1
|
||||
|
|
|
Loading…
Reference in New Issue