merge rpa branch
bzr revid: hmo@tinyerp.com-20080918141419-oaf2b4rv27q49b1n
This commit is contained in:
commit
c678885e71
|
@ -33,7 +33,7 @@ from osv import fields, osv
|
||||||
|
|
||||||
from tools.misc import currency
|
from tools.misc import currency
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
|
import pooler
|
||||||
import mx.DateTime
|
import mx.DateTime
|
||||||
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
|
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
|
||||||
|
|
||||||
|
@ -1522,6 +1522,61 @@ class account_config_fiscalyear(osv.osv_memory):
|
||||||
|
|
||||||
account_config_fiscalyear()
|
account_config_fiscalyear()
|
||||||
|
|
||||||
|
class account_config_charts(osv.osv_memory):
|
||||||
|
_name = 'account.config.charts'
|
||||||
|
|
||||||
|
def _get_charts(self, cr, uid, context):
|
||||||
|
module_obj=self.pool.get('ir.module.module')
|
||||||
|
ids=module_obj.search(cr, uid, [('category_id', '=', 'Account charts'), ('state', '<>', 'installed')])
|
||||||
|
res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)]
|
||||||
|
res.append((-1, 'None'))
|
||||||
|
res.sort(lambda x,y: cmp(x[1],y[1]))
|
||||||
|
return res
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'charts' : fields.selection(_get_charts, 'Charts of Account',required=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
def action_cancel(self,cr,uid,ids,conect=None):
|
||||||
|
return {
|
||||||
|
'view_type': 'form',
|
||||||
|
"view_mode": 'form',
|
||||||
|
'res_model': 'ir.module.module.configuration.wizard',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'target':'new',
|
||||||
|
}
|
||||||
|
|
||||||
|
def action_create(self, cr, uid,ids, context=None):
|
||||||
|
res=self.read(cr,uid,ids)[0]
|
||||||
|
id = res['charts']
|
||||||
|
def install(id):
|
||||||
|
mod_obj = self.pool.get('ir.module.module')
|
||||||
|
mod_obj.write(cr , uid, [id] ,{'state' : 'to install'})
|
||||||
|
mod_obj.download(cr, uid, [id], context=context)
|
||||||
|
cr.commit()
|
||||||
|
cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,))
|
||||||
|
ret = cr.fetchall()
|
||||||
|
if len(ret):
|
||||||
|
for r in ret:
|
||||||
|
install(r[0])
|
||||||
|
else:
|
||||||
|
mod_obj.write(cr , uid, [id] ,{'state' : 'to install'})
|
||||||
|
mod_obj.download(cr, uid, [id], context=context)
|
||||||
|
cr.commit()
|
||||||
|
install(id)
|
||||||
|
cr.commit()
|
||||||
|
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'view_type': 'form',
|
||||||
|
"view_mode": 'form',
|
||||||
|
'res_model': 'ir.module.module.configuration.wizard',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'target':'new',
|
||||||
|
}
|
||||||
|
|
||||||
|
account_config_charts()
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# Account Templates : Account, Tax, Tax Code and chart. + Wizard
|
# Account Templates : Account, Tax, Tax Code and chart. + Wizard
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -1352,6 +1352,35 @@
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="view_config_charts_form" model="ir.ui.view">
|
||||||
|
<field name="name">Select Charts of Account</field>
|
||||||
|
<field name="model">account.config.charts</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Select Charts of Account">
|
||||||
|
<separator colspan="2" string="Install Charts of Account"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="charts"/>
|
||||||
|
<newline/>
|
||||||
|
<separator string="" colspan="2"/>
|
||||||
|
<newline/>
|
||||||
|
<group col="2" colspan="2">
|
||||||
|
<button icon="gtk-cancel" special="cancel" string="Skip Step" name="action_cancel" type="object"/>
|
||||||
|
<button icon="gtk-ok" name="action_create" string="Install" type="object"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_config_charts_form" model="ir.actions.act_window">
|
||||||
|
<field name="name">Install Charts of Account</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.config.charts</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- register configuration wizard -->
|
<!-- register configuration wizard -->
|
||||||
|
@ -1362,6 +1391,13 @@
|
||||||
<field name="action_id" ref="action_config_fiscalyear_form"/>
|
<field name="action_id" ref="action_config_fiscalyear_form"/>
|
||||||
<field name="state">open</field>
|
<field name="state">open</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="config_charts" model="ir.module.module.configuration.step">
|
||||||
|
<field name="name">Select Charts of Account</field>
|
||||||
|
<field name="note">There are much more charts of accounts available on the OpenERP website.If you don't select one now, you'll be able to install another one through the Administration menu.</field>
|
||||||
|
<field name="action_id" ref="action_config_charts_form"/>
|
||||||
|
<field name="state">open</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- Account Templates -->
|
<!-- Account Templates -->
|
||||||
|
|
|
@ -48,19 +48,7 @@ view_form_profit = """<?xml version="1.0"?>
|
||||||
</group>
|
</group>
|
||||||
</form>"""
|
</form>"""
|
||||||
|
|
||||||
view_form_charts = """<?xml version="1.0"?>
|
|
||||||
<form string="Setup">
|
|
||||||
<image name="gtk-dialog-info" colspan="2"/>
|
|
||||||
<group>
|
|
||||||
<separator string="Select a Chart of Accounts" colspan="2"/>
|
|
||||||
<newline/>
|
|
||||||
<field name="charts" align="0.0"/>
|
|
||||||
<newline/>
|
|
||||||
<label string="There are much more charts of accounts available on the OpenERP website." colspan="2" align="0.0"/>
|
|
||||||
<newline/>
|
|
||||||
<label string="If you don't select one now, you'll be able to install another one through the Administration menu." colspan="2" align="0.0"/>
|
|
||||||
</group>
|
|
||||||
</form>"""
|
|
||||||
|
|
||||||
view_form_company = """<?xml version="1.0"?>
|
view_form_company = """<?xml version="1.0"?>
|
||||||
<form string="Setup">
|
<form string="Setup">
|
||||||
|
@ -94,9 +82,7 @@ view_form_update = """<?xml version="1.0"?>
|
||||||
<separator string="Summary" colspan="2"/>
|
<separator string="Summary" colspan="2"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<field name="profile" align="0.0" readonly="1"/>
|
<field name="profile" align="0.0" readonly="1"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<field name="charts" align="0.0" readonly="1"/>
|
|
||||||
<newline/>
|
|
||||||
<field name="name" align="0.0" readonly="1"/>
|
<field name="name" align="0.0" readonly="1"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
@ -124,14 +110,7 @@ class wizard_base_setup(wizard.interface):
|
||||||
res.sort()
|
res.sort()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_charts(self, cr, uid, context):
|
|
||||||
module_obj=pooler.get_pool(cr.dbname).get('ir.module.module')
|
|
||||||
ids=module_obj.search(cr, uid, [('category_id', '=', 'Account charts'),
|
|
||||||
('state', '<>', 'uninstallable')])
|
|
||||||
res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)]
|
|
||||||
res.append((-1, 'None'))
|
|
||||||
res.sort(lambda x,y: cmp(x[1],y[1]))
|
|
||||||
return res
|
|
||||||
|
|
||||||
def _get_company(self, cr, uid, data, context):
|
def _get_company(self, cr, uid, data, context):
|
||||||
pool=pooler.get_pool(cr.dbname)
|
pool=pooler.get_pool(cr.dbname)
|
||||||
|
@ -188,9 +167,7 @@ class wizard_base_setup(wizard.interface):
|
||||||
if 'profile' in data['form'] and data['form']['profile'] > 0:
|
if 'profile' in data['form'] and data['form']['profile'] > 0:
|
||||||
module_obj=pool.get('ir.module.module')
|
module_obj=pool.get('ir.module.module')
|
||||||
module_obj.state_update(cr, uid, [data['form']['profile']], 'to install', ['uninstalled'], context)
|
module_obj.state_update(cr, uid, [data['form']['profile']], 'to install', ['uninstalled'], context)
|
||||||
if 'charts' in data['form'] and data['form']['charts'] > 0:
|
|
||||||
module_obj=pool.get('ir.module.module')
|
|
||||||
module_obj.state_update(cr, uid, [data['form']['charts']], 'to install', ['uninstalled'], context)
|
|
||||||
|
|
||||||
company_obj=pool.get('res.company')
|
company_obj=pool.get('res.company')
|
||||||
partner_obj=pool.get('res.partner')
|
partner_obj=pool.get('res.partner')
|
||||||
|
@ -300,13 +277,7 @@ class wizard_base_setup(wizard.interface):
|
||||||
'default': -1,
|
'default': -1,
|
||||||
'required': True,
|
'required': True,
|
||||||
},
|
},
|
||||||
'charts':{
|
|
||||||
'string':'Chart of accounts',
|
|
||||||
'type':'selection',
|
|
||||||
'selection':_get_charts,
|
|
||||||
'default': -1,
|
|
||||||
'required': True,
|
|
||||||
},
|
|
||||||
'name':{
|
'name':{
|
||||||
'string': 'Company Name',
|
'string': 'Company Name',
|
||||||
'type': 'char',
|
'type': 'char',
|
||||||
|
@ -389,36 +360,36 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701""",
|
||||||
'result': {'type': 'form', 'arch': view_form_profit, 'fields': fields,
|
'result': {'type': 'form', 'arch': view_form_profit, 'fields': fields,
|
||||||
'state': [
|
'state': [
|
||||||
('menu', 'Cancel', 'gtk-cancel'),
|
('menu', 'Cancel', 'gtk-cancel'),
|
||||||
('next', 'Next', 'gtk-go-forward', True)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'next': {
|
|
||||||
'actions': [],
|
|
||||||
'result': {'type': 'choice', 'next_state': _next}
|
|
||||||
},
|
|
||||||
'charts':{
|
|
||||||
'actions': [],
|
|
||||||
'result': {'type': 'form', 'arch': view_form_charts, 'fields': fields,
|
|
||||||
'state':[
|
|
||||||
('init', 'Previous', 'gtk-go-back'),
|
|
||||||
('company', 'Next', 'gtk-go-forward', True)
|
('company', 'Next', 'gtk-go-forward', True)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
# 'next': {
|
||||||
|
# 'actions': [],
|
||||||
|
# 'result': {'type': 'choice', 'next_state': _next}
|
||||||
|
# },
|
||||||
|
# 'charts':{
|
||||||
|
# 'actions': [],
|
||||||
|
# 'result': {'type': 'form', 'arch': view_form_charts, 'fields': fields,
|
||||||
|
# 'state':[
|
||||||
|
# ('init', 'Previous', 'gtk-go-back'),
|
||||||
|
# ('company', 'Next', 'gtk-go-forward', True)
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# },
|
||||||
'company':{
|
'company':{
|
||||||
'actions': [],
|
'actions': [],
|
||||||
'result': {'type': 'form', 'arch': view_form_company, 'fields': fields,
|
'result': {'type': 'form', 'arch': view_form_company, 'fields': fields,
|
||||||
'state': [
|
'state': [
|
||||||
('previous', 'Previous', 'gtk-go-back'),
|
('init', 'Previous', 'gtk-go-back'),
|
||||||
('update', 'Next', 'gtk-go-forward', True)
|
('update', 'Next', 'gtk-go-forward', True)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'previous':{
|
# 'previous':{
|
||||||
'actions': [],
|
# 'actions': [],
|
||||||
'result': {'type': 'choice', 'next_state': _previous}
|
# 'result': {'type': 'choice', 'next_state': _previous}
|
||||||
},
|
# },
|
||||||
'update':{
|
'update':{
|
||||||
'actions': [],
|
'actions': [],
|
||||||
'result': {'type': 'form', 'arch': view_form_update, 'fields': fields,
|
'result': {'type': 'form', 'arch': view_form_update, 'fields': fields,
|
||||||
|
|
|
@ -304,6 +304,33 @@ class mrp_production(osv.osv):
|
||||||
_name = 'mrp.production'
|
_name = 'mrp.production'
|
||||||
_description = 'Production'
|
_description = 'Production'
|
||||||
_date_name = 'date_planned'
|
_date_name = 'date_planned'
|
||||||
|
|
||||||
|
def _get_sale_order(self,cr,uid,ids,field_name=False):
|
||||||
|
move_obj=self.pool.get('stock.move')
|
||||||
|
def get_parent_move(move_id):
|
||||||
|
move = move_obj.browse(cr,uid,move_id)
|
||||||
|
if move.move_dest_id:
|
||||||
|
return get_parent_move(move.move_dest_id.id)
|
||||||
|
return move_id
|
||||||
|
productions=self.read(cr,uid,ids,['id','move_prod_id'])
|
||||||
|
res={}
|
||||||
|
for production in productions:
|
||||||
|
if production.get('move_prod_id',False):
|
||||||
|
parent_move_line=get_parent_move(production['move_prod_id'][0])
|
||||||
|
if parent_move_line:
|
||||||
|
move = move_obj.browse(cr,uid,parent_move_line)
|
||||||
|
if field_name=='name':
|
||||||
|
res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.name or False
|
||||||
|
if field_name=='client_order_ref':
|
||||||
|
res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _sale_name_calc(self, cr, uid, ids, prop, unknow_none, unknow_dict):
|
||||||
|
return self._get_sale_order(cr,uid,ids,field_name='name')
|
||||||
|
|
||||||
|
def _sale_ref_calc(self, cr, uid, ids, prop, unknow_none, unknow_dict):
|
||||||
|
return self._get_sale_order(cr,uid,ids,field_name='client_order_ref')
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Reference', size=64, required=True),
|
'name': fields.char('Reference', size=64, required=True),
|
||||||
'origin': fields.char('Origin', size=64),
|
'origin': fields.char('Origin', size=64),
|
||||||
|
@ -332,7 +359,9 @@ class mrp_production(osv.osv):
|
||||||
'product_lines': fields.one2many('mrp.production.product.line', 'production_id', 'Scheduled goods'),
|
'product_lines': fields.one2many('mrp.production.product.line', 'production_id', 'Scheduled goods'),
|
||||||
'workcenter_lines': fields.one2many('mrp.production.workcenter.line', 'production_id', 'Workcenters Utilisation'),
|
'workcenter_lines': fields.one2many('mrp.production.workcenter.line', 'production_id', 'Workcenters Utilisation'),
|
||||||
|
|
||||||
'state': fields.selection([('draft','Draft'),('picking_except', 'Packing Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')],'Status', readonly=True)
|
'state': fields.selection([('draft','Draft'),('picking_except', 'Packing Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')],'Status', readonly=True),
|
||||||
|
'sale_name': fields.function(_sale_name_calc, method=True, type='char', string='Sale Name'),
|
||||||
|
'sale_ref': fields.function(_sale_ref_calc, method=True, type='char', string='Sale Ref'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'priority': lambda *a: '1',
|
'priority': lambda *a: '1',
|
||||||
|
|
|
@ -4,5 +4,14 @@
|
||||||
|
|
||||||
<report auto="True" header="False" id="report_bom_structure" model="mrp.bom" name="bom.structure" rml="mrp/report/bom_structure.rml" string="BOM Structure"/>
|
<report auto="True" header="False" id="report_bom_structure" model="mrp.bom" name="bom.structure" rml="mrp/report/bom_structure.rml" string="BOM Structure"/>
|
||||||
|
|
||||||
|
<report
|
||||||
|
id="report_mrp_production_report"
|
||||||
|
string="Production Order"
|
||||||
|
model="mrp.production"
|
||||||
|
name="mrp.production.order"
|
||||||
|
rml="mrp/report/order.rml"
|
||||||
|
auto="False"
|
||||||
|
/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -406,7 +406,6 @@
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="date_planned" select="1"/>
|
<field name="date_planned" select="1"/>
|
||||||
<field name="priority"/>
|
<field name="priority"/>
|
||||||
|
|
||||||
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
|
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="product_uom"/>
|
<field name="product_uom"/>
|
||||||
|
@ -448,6 +447,8 @@
|
||||||
<field name="date_finnished"/>
|
<field name="date_finnished"/>
|
||||||
<field name="picking_id"/>
|
<field name="picking_id"/>
|
||||||
<field name="move_prod_id"/>
|
<field name="move_prod_id"/>
|
||||||
|
<field name="sale_name"/>
|
||||||
|
<field name="sale_ref"/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
import price
|
import price
|
||||||
import workcenter_load
|
import workcenter_load
|
||||||
|
import order
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
from report import report_sxw
|
||||||
|
from osv import osv
|
||||||
|
import pooler
|
||||||
|
|
||||||
|
class order(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(order, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update({
|
||||||
|
'time': time,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order)
|
|
@ -0,0 +1,135 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="34.0" y1="42.0" width="527" height="758"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="16.0" leading="20"/>
|
||||||
|
<paraStyle name="P2" fontName="Helvetica" fontSize="16.0" leading="20"/>
|
||||||
|
<paraStyle name="P3" fontName="Helvetica"/>
|
||||||
|
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P5" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="9.0" leading="11"/>
|
||||||
|
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P10" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P11" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P12" fontName="Helvetica" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P13" fontName="Helvetica-Oblique" fontSize="9.0" leading="11"/>
|
||||||
|
<paraStyle name="P14" fontName="Helvetica" fontSize="9.0" leading="11"/>
|
||||||
|
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P17" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P18" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="3.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<images/>
|
||||||
|
<story>
|
||||||
|
<para style="P14">[[ repeatIn(objects,'o') ]] </para>
|
||||||
|
<para style="P13">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P14">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P1">Production Order N° : [[ o.name ]]</para>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P18">Printing date : [[ time.strftime('%d/%m/%Y') ]]</para>
|
||||||
|
<para style="P18">Partner Order reference : [[ o.sale_ref or ' ' ]]</para>
|
||||||
|
<para style="P18">SO number : [[ o.sale_name or '' ]]</para>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="130.0,313.0,85.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Product Name</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Product Description</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">Qty</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<section>
|
||||||
|
<blockTable colWidths="130.0,312.0,86.0" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">[[ '['+ o.product_id.code +']' ]] [[ o.product_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P10">[[ o.product_id.description ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">[[ '%.2f' % o.product_qty ]] [[ o.product_uom.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="P7">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> .........</font>
|
||||||
|
<font color="white"> .........</font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="86.0,16.0,425.0" style="Table3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P15">Planned Date </para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P16">:</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P15">[[ time.strftime('%d/%m/%Y', time.strptime(o.date_planned, '%Y-%m-%d %H:%M:%S')) ]]</para>
|
||||||
|
<para style="P9">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P12">
|
||||||
|
<font face="Times-Roman"/>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
|
@ -411,7 +411,7 @@ class purchase_order_line(osv.osv):
|
||||||
if not pricelist:
|
if not pricelist:
|
||||||
raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist in the purchase form !\nPlease set one before choosing a product.'))
|
raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist in the purchase form !\nPlease set one before choosing a product.'))
|
||||||
if not product:
|
if not product:
|
||||||
return {'value': {'price_unit': 0.0, 'name':'','notes':''}, 'domain':{'product_uom':[]}}
|
return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}}
|
||||||
lang=False
|
lang=False
|
||||||
if partner_id:
|
if partner_id:
|
||||||
lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang']
|
lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang']
|
||||||
|
|
|
@ -301,7 +301,7 @@ class sale_order(osv.osv):
|
||||||
def _inv_get(self, cr, uid, order, context={}):
|
def _inv_get(self, cr, uid, order, context={}):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _make_invoice(self, cr, uid, order, lines, context={}):
|
def _make_invoice(self, cr, uid, order, lines,context={}):
|
||||||
a = order.partner_id.property_account_receivable.id
|
a = order.partner_id.property_account_receivable.id
|
||||||
if order.payment_term:
|
if order.payment_term:
|
||||||
pay_term = order.payment_term.id
|
pay_term = order.payment_term.id
|
||||||
|
@ -770,10 +770,10 @@ class sale_order_line(osv.osv):
|
||||||
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
|
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
|
||||||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||||
lang=False, update_tax=True, date_order=False, packaging=False):
|
lang=False, update_tax=True, date_order=False, packaging=False):
|
||||||
|
warning={}
|
||||||
product_uom_obj = self.pool.get('product.uom')
|
product_uom_obj = self.pool.get('product.uom')
|
||||||
partner_obj = self.pool.get('res.partner')
|
partner_obj = self.pool.get('res.partner')
|
||||||
product_obj = self.pool.get('product.product')
|
product_obj = self.pool.get('product.product')
|
||||||
|
|
||||||
if partner_id:
|
if partner_id:
|
||||||
lang = partner_obj.browse(cr, uid, partner_id).lang
|
lang = partner_obj.browse(cr, uid, partner_id).lang
|
||||||
context = {'lang': lang, 'partner_id': partner_id}
|
context = {'lang': lang, 'partner_id': partner_id}
|
||||||
|
@ -781,7 +781,7 @@ class sale_order_line(osv.osv):
|
||||||
if not product:
|
if not product:
|
||||||
return {'value': {'th_weight' : 0, 'product_packaging': False,
|
return {'value': {'th_weight' : 0, 'product_packaging': False,
|
||||||
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
||||||
'product_uos': []}}
|
'product_uos': []}}
|
||||||
|
|
||||||
if not date_order:
|
if not date_order:
|
||||||
date_order = time.strftime('%Y-%m-%d')
|
date_order = time.strftime('%Y-%m-%d')
|
||||||
|
@ -792,9 +792,19 @@ class sale_order_line(osv.osv):
|
||||||
default_uom = product_obj.uom_id and product_obj.uom_id.id
|
default_uom = product_obj.uom_id and product_obj.uom_id.id
|
||||||
pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context)
|
pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context)
|
||||||
q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
|
q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
|
||||||
qty = qty - qty % q + q
|
# qty = qty - qty % q + q
|
||||||
|
if not (qty % q) == 0 :
|
||||||
|
ean = pack.ean
|
||||||
|
qty_pack = pack.qty
|
||||||
|
type_ul = pack.ul
|
||||||
|
warn_msg = "You selected a quantity of %d Units.\nBut it's not compatible with the selected packaging.\nHere is a proposition of quantities according to the packaging: " % (qty)
|
||||||
|
warn_msg = warn_msg + "\n\nEAN: " + str(ean) + " Quantiny: " + str(qty_pack) + " Type of ul: " + str(type_ul.name)
|
||||||
|
warning={
|
||||||
|
'title':'Packing Information !',
|
||||||
|
'message': warn_msg
|
||||||
|
}
|
||||||
result['product_uom_qty'] = qty
|
result['product_uom_qty'] = qty
|
||||||
|
|
||||||
if uom:
|
if uom:
|
||||||
uom2 = product_uom_obj.browse(cr, uid, uom)
|
uom2 = product_uom_obj.browse(cr, uid, uom)
|
||||||
if product_obj.uom_id.category_id.id <> uom2.category_id.id:
|
if product_obj.uom_id.category_id.id <> uom2.category_id.id:
|
||||||
|
@ -864,7 +874,7 @@ class sale_order_line(osv.osv):
|
||||||
# Round the quantity up
|
# Round the quantity up
|
||||||
|
|
||||||
# get unit price
|
# get unit price
|
||||||
warning={}
|
|
||||||
if not pricelist:
|
if not pricelist:
|
||||||
warning={
|
warning={
|
||||||
'title':'No Pricelist !',
|
'title':'No Pricelist !',
|
||||||
|
@ -884,11 +894,9 @@ class sale_order_line(osv.osv):
|
||||||
'message':
|
'message':
|
||||||
"Couldn't find a pricelist line matching this product and quantity.\n"
|
"Couldn't find a pricelist line matching this product and quantity.\n"
|
||||||
"You have to change either the product, the quantity or the pricelist."
|
"You have to change either the product, the quantity or the pricelist."
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
result.update({'price_unit': price})
|
result.update({'price_unit': price})
|
||||||
|
|
||||||
|
|
||||||
return {'value': result, 'domain': domain,'warning':warning}
|
return {'value': result, 'domain': domain,'warning':warning}
|
||||||
|
|
||||||
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
|
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
|
||||||
|
|
|
@ -114,3 +114,4 @@ stock_picking()
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,3 @@
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ def _createInvoices(self, cr, uid, data, context={}):
|
||||||
'invoice_line': [(6,0,create_ids)],
|
'invoice_line': [(6,0,create_ids)],
|
||||||
'currency_id' :sale.pricelist_id.currency_id.id,
|
'currency_id' :sale.pricelist_id.currency_id.id,
|
||||||
'comment': '',
|
'comment': '',
|
||||||
'payment_term':sale.partner_id.property_payment_term.id,
|
'payment_term':sale.payment_term.id,
|
||||||
}
|
}
|
||||||
inv_obj = pool_obj.get('account.invoice')
|
inv_obj = pool_obj.get('account.invoice')
|
||||||
inv_id = inv_obj.create(cr, uid, inv)
|
inv_id = inv_obj.create(cr, uid, inv)
|
||||||
|
|
|
@ -497,7 +497,25 @@ class stock_picking(osv.osv):
|
||||||
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def draft_force_assign(self, cr, uid, ids, *args):
|
||||||
|
wf_service = netsvc.LocalService("workflow")
|
||||||
|
for pick in self.browse(cr, uid, ids):
|
||||||
|
wf_service.trg_validate(uid, 'stock.picking', pick.id,
|
||||||
|
'button_confirm', cr)
|
||||||
|
move_ids = [x.id for x in pick.move_lines]
|
||||||
|
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||||
|
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def draft_validate(self, cr, uid, ids, *args):
|
||||||
|
wf_service = netsvc.LocalService("workflow")
|
||||||
|
self.draft_force_assign(cr, uid, ids)
|
||||||
|
for pick in self.browse(cr, uid, ids):
|
||||||
|
self.action_move(cr, uid, [pick.id])
|
||||||
|
wf_service.trg_validate(uid, 'stock.picking', pick.id , 'button_done', cr)
|
||||||
|
return True
|
||||||
|
|
||||||
def cancel_assign(self, cr, uid, ids, *args):
|
def cancel_assign(self, cr, uid, ids, *args):
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
for pick in self.browse(cr, uid, ids):
|
for pick in self.browse(cr, uid, ids):
|
||||||
|
@ -607,7 +625,8 @@ class stock_picking(osv.osv):
|
||||||
invoice_line_obj = self.pool.get('account.invoice.line')
|
invoice_line_obj = self.pool.get('account.invoice.line')
|
||||||
invoices_group = {}
|
invoices_group = {}
|
||||||
res = {}
|
res = {}
|
||||||
|
sale_line_obj = self.pool.get('sale.order.line')
|
||||||
|
|
||||||
for picking in self.browse(cursor, user, ids, context=context):
|
for picking in self.browse(cursor, user, ids, context=context):
|
||||||
if picking.invoice_state != '2binvoiced':
|
if picking.invoice_state != '2binvoiced':
|
||||||
continue
|
continue
|
||||||
|
@ -645,7 +664,51 @@ class stock_picking(osv.osv):
|
||||||
context=context)
|
context=context)
|
||||||
invoices_group[partner.id] = invoice_id
|
invoices_group[partner.id] = invoice_id
|
||||||
res[picking.id] = invoice_id
|
res[picking.id] = invoice_id
|
||||||
|
|
||||||
|
sale_line_ids = sale_line_obj.search(cursor, user, [('order_id','=',picking.sale_id.id)])
|
||||||
|
sale_lines = sale_line_obj.browse(cursor, user, sale_line_ids, context=context)
|
||||||
|
|
||||||
|
for sale_line in sale_lines:
|
||||||
|
if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
|
||||||
|
if group:
|
||||||
|
name = picking.name + '-' + sale_line.name
|
||||||
|
else:
|
||||||
|
name = sale_line.name
|
||||||
|
if type in ('out_invoice', 'out_refund'):
|
||||||
|
account_id = sale_line.product_id.product_tmpl_id.\
|
||||||
|
property_account_income.id
|
||||||
|
if not account_id:
|
||||||
|
account_id = sale_line.product_id.categ_id.\
|
||||||
|
property_account_income_categ.id
|
||||||
|
else:
|
||||||
|
account_id = sale_line.product_id.product_tmpl_id.\
|
||||||
|
property_account_expense.id
|
||||||
|
if not account_id:
|
||||||
|
account_id = sale_line.product_id.categ_id.\
|
||||||
|
property_account_expense_categ.id
|
||||||
|
price_unit = self._get_price_unit_invoice(cursor, user,
|
||||||
|
sale_line, type)
|
||||||
|
discount = self._get_discount_invoice(cursor, user, sale_line)
|
||||||
|
tax_ids = self._get_taxes_invoice(cursor, user, sale_line, type)
|
||||||
|
account_analytic_id = self._get_account_analytic_invoice(cursor,
|
||||||
|
user, picking, sale_line)
|
||||||
|
|
||||||
|
invoice_line_id = invoice_line_obj.create(cursor, user, {
|
||||||
|
'name': name,
|
||||||
|
'invoice_id': invoice_id,
|
||||||
|
'uos_id': sale_line.product_uos.id or sale_line.product_uom.id,
|
||||||
|
'product_id': sale_line.product_id.id,
|
||||||
|
'account_id': account_id,
|
||||||
|
'price_unit': price_unit,
|
||||||
|
'discount': discount,
|
||||||
|
'quantity': sale_line.product_uos_qty,
|
||||||
|
'invoice_line_tax_id': [(6, 0, tax_ids)],
|
||||||
|
'account_analytic_id': account_analytic_id,
|
||||||
|
}, context=context)
|
||||||
|
sale_line_obj.write(cursor, user, [sale_line.id], {'invoiced':True,
|
||||||
|
'invoice_lines': [(6, 0, [invoice_line_id])],
|
||||||
|
})
|
||||||
|
|
||||||
for move_line in picking.move_lines:
|
for move_line in picking.move_lines:
|
||||||
if group:
|
if group:
|
||||||
name = picking.name + '-' + move_line.name
|
name = picking.name + '-' + move_line.name
|
||||||
|
|
|
@ -550,9 +550,10 @@
|
||||||
<label colspan="6"/>
|
<label colspan="6"/>
|
||||||
<button name="%(move_split)d" string="Split move lines in two" type="action"/>
|
<button name="%(move_split)d" string="Split move lines in two" type="action"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="8" colspan="4">
|
<group col="10" colspan="4">
|
||||||
<field name="state" readonly="1"/>
|
<field name="state" readonly="1"/>
|
||||||
<button name="button_confirm" states="draft" string="Confirm"/>
|
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
|
||||||
|
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
|
||||||
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
||||||
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
||||||
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
||||||
|
@ -638,9 +639,10 @@
|
||||||
<label colspan="6"/>
|
<label colspan="6"/>
|
||||||
<button name="%(move_split)d" string="Split in Two" type="action"/>
|
<button name="%(move_split)d" string="Split in Two" type="action"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="8" colspan="4">
|
<group col="10" colspan="4">
|
||||||
<field name="state" readonly="1"/>
|
<field name="state" readonly="1"/>
|
||||||
<button name="button_confirm" states="draft" string="Confirm"/>
|
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
|
||||||
|
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
|
||||||
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
||||||
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
||||||
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
||||||
|
@ -806,9 +808,10 @@
|
||||||
<label colspan="6"/>
|
<label colspan="6"/>
|
||||||
<button name="%(move_split)d" string="Split in Two" type="action"/>
|
<button name="%(move_split)d" string="Split in Two" type="action"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="8" colspan="4">
|
<group col="10" colspan="4">
|
||||||
<field name="state" readonly="1"/>
|
<field name="state" readonly="1"/>
|
||||||
<button name="button_confirm" states="draft" string="Confirm"/>
|
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
|
||||||
|
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
|
||||||
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
||||||
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
||||||
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
||||||
|
@ -975,9 +978,10 @@
|
||||||
<label colspan="5"/>
|
<label colspan="5"/>
|
||||||
<button name="%(act_stock_picking_move_wizard)d" string="Fill From Unreceived Products" type="action"/>
|
<button name="%(act_stock_picking_move_wizard)d" string="Fill From Unreceived Products" type="action"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="8" colspan="4">
|
<group col="10" colspan="4">
|
||||||
<field name="state" readonly="1"/>
|
<field name="state" readonly="1"/>
|
||||||
<button name="button_confirm" states="draft" string="Confirm" type="object"/>
|
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
|
||||||
|
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
|
||||||
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
|
||||||
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
|
||||||
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
|
||||||
|
@ -1264,4 +1268,3 @@
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
||||||
|
|
|
@ -34,5 +34,13 @@
|
||||||
multi="True"
|
multi="True"
|
||||||
id="wizard_merge_inventory"/>
|
id="wizard_merge_inventory"/>
|
||||||
|
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
string="Fill Inventory"
|
||||||
|
model="stock.inventory"
|
||||||
|
name="stock.fill_inventory"
|
||||||
|
keyword="client_action_multi"
|
||||||
|
id="wizard_fill_inventory"
|
||||||
|
/>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -37,8 +37,9 @@ import wizard_split_lot_line
|
||||||
import wizard_track_line
|
import wizard_track_line
|
||||||
import wizard_ups
|
import wizard_ups
|
||||||
import wizard_invoice_onshipping
|
import wizard_invoice_onshipping
|
||||||
import inventory_merge
|
import wizard_move_by_location
|
||||||
|
import wizard_inventory
|
||||||
import inventory_merge_zero
|
import inventory_merge_zero
|
||||||
|
import inventory_merge
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
import wizard
|
||||||
|
import ir
|
||||||
|
import pooler
|
||||||
|
from osv.osv import except_osv
|
||||||
|
from osv import fields,osv
|
||||||
|
import netsvc
|
||||||
|
|
||||||
|
inventory_form = """<?xml version="1.0"?>
|
||||||
|
<form string="Fill Inventory">
|
||||||
|
<separator colspan="4" string="Fill Inventory for specific location" />
|
||||||
|
<field name="location_id"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="recursive"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
"""
|
||||||
|
|
||||||
|
inventory_fields = {
|
||||||
|
'location_id' : {
|
||||||
|
'string':'Location',
|
||||||
|
'type':'many2one',
|
||||||
|
'relation':'stock.location',
|
||||||
|
'required':True
|
||||||
|
},
|
||||||
|
'recursive' : {'string':'Include all childs for the location', 'type':'boolean'}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _fill_inventory(self, cr, uid, data, context):
|
||||||
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
inventory_line_obj = pooler.get_pool(cr.dbname).get('stock.inventory.line')
|
||||||
|
location_obj = pooler.get_pool(cr.dbname).get('stock.location')
|
||||||
|
res={}
|
||||||
|
res_location={}
|
||||||
|
if data['form']['recursive'] :
|
||||||
|
location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', [data['form']['location_id']])])
|
||||||
|
for location in location_ids :
|
||||||
|
res=location_obj._product_get(cr, uid, location)
|
||||||
|
res_location[location]=res
|
||||||
|
else:
|
||||||
|
res=location_obj._product_get(cr, uid, data['form']['location_id'])
|
||||||
|
res_location[data['form']['location_id']]=res
|
||||||
|
|
||||||
|
product_ids=[]
|
||||||
|
for location in res_location.keys():
|
||||||
|
res=res_location[location]
|
||||||
|
for product_id in res.keys():
|
||||||
|
#product_ids.append(product_id)
|
||||||
|
prod = pool.get('product.product').browse(cr, uid, [product_id])[0]
|
||||||
|
uom = prod.uom_id.id
|
||||||
|
amount=pool.get('stock.location')._product_get(cr, uid, location, [product_id], {'uom': uom})[product_id]
|
||||||
|
|
||||||
|
if(amount):
|
||||||
|
line_ids=inventory_line_obj.search(cr,uid,[('inventory_id','=',data['id']),('location_id','=',location),('product_id','=',product_id),('product_uom','=',uom),('product_qty','=',amount)])
|
||||||
|
if not len(line_ids):
|
||||||
|
inventory_line={'inventory_id':data['id'],'location_id':location,'product_id':product_id,'product_uom':uom,'product_qty':amount}
|
||||||
|
inventory_line_obj.create(cr, uid, inventory_line)
|
||||||
|
product_ids.append(product_id)
|
||||||
|
|
||||||
|
if(len(product_ids)==0):
|
||||||
|
raise wizard.except_wizard('Message ! ','No product in this location.')
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class fill_inventory(wizard.interface):
|
||||||
|
states = {
|
||||||
|
'init' : {
|
||||||
|
'actions' : [],
|
||||||
|
'result' : {'type' : 'form',
|
||||||
|
'arch' : inventory_form,
|
||||||
|
'fields' : inventory_fields,
|
||||||
|
'state' : [('end', 'Cancel'),('fill_inventory', 'Fill Inventory') ]}
|
||||||
|
},
|
||||||
|
'fill_inventory' : {
|
||||||
|
'actions' : [],
|
||||||
|
'result' : {'type' : 'action', 'action': _fill_inventory, 'state' : 'end'}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
fill_inventory("stock.fill_inventory")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard
|
||||||
|
import pooler
|
||||||
|
import time
|
||||||
|
|
||||||
|
def _action_open_window(self, cr, uid, data, context):
|
||||||
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
mod_obj = pool.get('ir.model.data')
|
||||||
|
act_obj = pool.get('ir.actions.act_window')
|
||||||
|
|
||||||
|
result = mod_obj._get_id(cr, uid, 'stock', 'action_move_form2')
|
||||||
|
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||||
|
result = act_obj.read(cr, uid, [id])[0]
|
||||||
|
location_id = data['ids'][0]
|
||||||
|
|
||||||
|
domain = []
|
||||||
|
# domain += [ '|' ,('location_id', '=', location_id) , ('location_dest_id', '=', location_id)]
|
||||||
|
if data['form']['from']:
|
||||||
|
domain += [('date_planned', '>=', data['form']['from'])]
|
||||||
|
|
||||||
|
if data['form']['to']:
|
||||||
|
domain += [('date_planned', '<=', data['form']['to'])]
|
||||||
|
result['domain'] = str(domain)
|
||||||
|
# result['context'] = str({'location_id': location_id })
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class move_by_location(wizard.interface):
|
||||||
|
|
||||||
|
form1 = '''<?xml version="1.0"?>
|
||||||
|
<form string="View Stock Moves">
|
||||||
|
<field name="from"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="to"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
form1_fields = {
|
||||||
|
'from': {
|
||||||
|
'string': 'From',
|
||||||
|
'type': 'date',
|
||||||
|
},
|
||||||
|
'to': {
|
||||||
|
'string': 'To',
|
||||||
|
'type': 'date',
|
||||||
|
# 'default': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [ ('open', 'Open Moves'),('end', 'Cancel')]}
|
||||||
|
},
|
||||||
|
'open': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
move_by_location('stock.location.moves')
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -73,5 +73,5 @@ class stock_location(osv.osv):
|
||||||
for path in product.path_ids:
|
for path in product.path_ids:
|
||||||
if path.location_from_id.id == location.id:
|
if path.location_from_id.id == location.id:
|
||||||
return path.location_dest_id, path.auto, path.delay
|
return path.location_dest_id, path.auto, path.delay
|
||||||
return super(stock_location, self).chained_location_get(cr, uid, location, partner, product, contex)
|
return super(stock_location, self).chained_location_get(cr, uid, location, partner, product, context)
|
||||||
stock_location()
|
stock_location()
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import warning
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
###############################################################################
|
||||||
|
{
|
||||||
|
"name":"Module for Warnings form onchange Event",
|
||||||
|
"version":"1.0",
|
||||||
|
"author":"Tiny",
|
||||||
|
"category":"Tools",
|
||||||
|
"depends":["base","sale"],
|
||||||
|
"demo_xml":[],
|
||||||
|
"update_xml":[
|
||||||
|
"warning_view.xml"],
|
||||||
|
"description": "Module for Warnings form onchange Event.",
|
||||||
|
"active":False,
|
||||||
|
"installable":True,
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,191 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
from osv import fields,osv
|
||||||
|
|
||||||
|
class res_partner(osv.osv):
|
||||||
|
_inherit = 'res.partner'
|
||||||
|
_columns = {
|
||||||
|
'sale_warn' : fields.boolean('Sale Order'),
|
||||||
|
'sale_warn_msg' : fields.char('Message for Sale Order', size=64),
|
||||||
|
'purchase_warn' : fields.boolean('Purchase Order'),
|
||||||
|
'purchase_warn_msg' : fields.char('Message for Purchase Order', size=64),
|
||||||
|
'picking_warn' : fields.boolean('Stock Picking'),
|
||||||
|
'picking_warn_msg' : fields.char('Message for Stock Picking', size=64),
|
||||||
|
'invoice_warn' : fields.boolean('Invoice'),
|
||||||
|
'invoice_warn_msg' : fields.char('Message for Invoice', size=64),
|
||||||
|
}
|
||||||
|
res_partner()
|
||||||
|
|
||||||
|
|
||||||
|
class sale_order(osv.osv):
|
||||||
|
_inherit = 'sale.order'
|
||||||
|
def onchange_partner_id(self, cr, uid, ids, part):
|
||||||
|
if not part:
|
||||||
|
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
|
||||||
|
warning = {}
|
||||||
|
title=False
|
||||||
|
message=False
|
||||||
|
partner = self.pool.get('res.partner').browse(cr, uid, part)
|
||||||
|
if partner.sale_warn:
|
||||||
|
title= "Message",
|
||||||
|
message=partner.sale_warn_msg
|
||||||
|
|
||||||
|
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
|
||||||
|
if result.get('warning',False):
|
||||||
|
warning['title']=title and title+' & '+result['warning']['title'] or result['warning']['title']
|
||||||
|
warning['message']=message and message +' '+result['warning']['message'] or result['warning']['message']
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
sale_order()
|
||||||
|
|
||||||
|
|
||||||
|
class purchase_order(osv.osv):
|
||||||
|
_inherit = 'purchase.order'
|
||||||
|
def onchange_partner_id(self, cr, uid, ids, part):
|
||||||
|
if not part:
|
||||||
|
return {'value':{'partner_address_id': False}}
|
||||||
|
warning = {}
|
||||||
|
partner = self.pool.get('res.partner').browse(cr, uid, part)
|
||||||
|
if partner.purchase_warn:
|
||||||
|
warning={
|
||||||
|
'title': "Message",
|
||||||
|
'message': partner.purchase_warn_msg
|
||||||
|
}
|
||||||
|
result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)['value']
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
|
||||||
|
purchase_order()
|
||||||
|
|
||||||
|
|
||||||
|
class account_invoice(osv.osv):
|
||||||
|
_inherit = 'account.invoice'
|
||||||
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
|
||||||
|
date_invoice=False, payment_term=False, partner_bank_id=False):
|
||||||
|
if not partner_id:
|
||||||
|
return {'value': {
|
||||||
|
'address_contact_id': False ,
|
||||||
|
'address_invoice_id': False,
|
||||||
|
'account_id': False,
|
||||||
|
'payment_term': False,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
warning = {}
|
||||||
|
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||||
|
if partner.invoice_warn:
|
||||||
|
warning={
|
||||||
|
'title': "Message",
|
||||||
|
'message': partner.invoice_warn_msg
|
||||||
|
}
|
||||||
|
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
|
||||||
|
date_invoice=False, payment_term=False, partner_bank_id=False)['value']
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
|
||||||
|
account_invoice()
|
||||||
|
|
||||||
|
class stock_picking(osv.osv):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
def onchange_partner_in(self, cr, uid, context, partner_id=None):
|
||||||
|
if not partner_id:
|
||||||
|
return {}
|
||||||
|
partner = self.pool.get('res.partner.address').browse(cr, uid, [partner_id])[0].partner_id
|
||||||
|
warning = {}
|
||||||
|
if partner.picking_warn:
|
||||||
|
warning={
|
||||||
|
'title': "Message",
|
||||||
|
'message': partner.picking_warn_msg
|
||||||
|
}
|
||||||
|
result = super(stock_picking, self).onchange_partner_in(cr, uid, context, partner_id)
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
|
||||||
|
stock_picking()
|
||||||
|
|
||||||
|
class product_product(osv.osv):
|
||||||
|
_inherit = 'product.product'
|
||||||
|
_columns = {
|
||||||
|
'sale_line_warn' : fields.boolean('Sale Order Line'),
|
||||||
|
'sale_line_warn_msg' : fields.char('Message for Sale Order Line', size=64),
|
||||||
|
'purchase_line_warn' : fields.boolean('Purchase Order Line'),
|
||||||
|
'purchase_line_warn_msg' : fields.char('Message for Purchase Order Line', size=64),
|
||||||
|
}
|
||||||
|
product_product()
|
||||||
|
|
||||||
|
class sale_order_line(osv.osv):
|
||||||
|
_inherit = 'sale.order.line'
|
||||||
|
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
|
||||||
|
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||||
|
lang=False, update_tax=True, date_order=False, packaging=False):
|
||||||
|
warning = {}
|
||||||
|
if not product:
|
||||||
|
return {'value': {'th_weight' : 0, 'product_packaging': False,
|
||||||
|
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
||||||
|
'product_uos': []}}
|
||||||
|
product_obj = self.pool.get('product.product')
|
||||||
|
product_info = product_obj.browse(cr, uid, product)
|
||||||
|
title=False
|
||||||
|
message=False
|
||||||
|
if product_info.sale_line_warn:
|
||||||
|
title= "Message",
|
||||||
|
message= product_info.sale_line_warn_msg
|
||||||
|
|
||||||
|
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty=0,
|
||||||
|
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||||
|
lang=False, update_tax=True, date_order=False, packaging=False)['value']
|
||||||
|
if result.get('warning',False):
|
||||||
|
warning['title']=title and title+' & '+result['warning']['title'] or result['warning']['title']
|
||||||
|
warning['message']=message and message +' '+result['warning']['message'] or result['warning']['message']
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
|
||||||
|
sale_order_line()
|
||||||
|
|
||||||
|
class purchase_order_line(osv.osv):
|
||||||
|
_inherit = 'purchase.order.line'
|
||||||
|
def product_id_change(self,cr, uid, ids, pricelist, product, qty, uom,
|
||||||
|
partner_id, date_order=False):
|
||||||
|
warning = {}
|
||||||
|
if not product:
|
||||||
|
return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}}
|
||||||
|
product_obj = self.pool.get('product.product')
|
||||||
|
product_info = product_obj.browse(cr, uid, product)
|
||||||
|
if product_info.purchase_line_warn:
|
||||||
|
warning={
|
||||||
|
'title': "Message",
|
||||||
|
'message': product_info.purchase_line_warn_msg
|
||||||
|
}
|
||||||
|
|
||||||
|
result = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom,
|
||||||
|
partner_id, date_order=False)['value']
|
||||||
|
return {'value': result, 'warning':warning}
|
||||||
|
|
||||||
|
purchase_order_line()
|
||||||
|
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="view_partner_warning_form" model="ir.ui.view">
|
||||||
|
<field name="name">res.partner.warning.form.inherit</field>
|
||||||
|
<field name="model">res.partner</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<notebook>
|
||||||
|
<page string="Messages" position="inside">
|
||||||
|
<newline/>
|
||||||
|
<field name="sale_warn"/>
|
||||||
|
<field name="sale_warn_msg"/>
|
||||||
|
<field name="purchase_warn"/>
|
||||||
|
<field name="purchase_warn_msg"/>
|
||||||
|
<field name="picking_warn"/>
|
||||||
|
<field name="picking_warn_msg"/>
|
||||||
|
<field name="invoice_warn"/>
|
||||||
|
<field name="invoice_warn_msg"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="product_warning_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.warning.form.inherit</field>
|
||||||
|
<field name="model">product.product</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<notebook position="inside">
|
||||||
|
<page string="Messages">
|
||||||
|
<field name="sale_line_warn"/>
|
||||||
|
<field name="sale_line_warn_msg"/>
|
||||||
|
<field name="purchase_line_warn"/>
|
||||||
|
<field name="purchase_line_warn_msg"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
Loading…
Reference in New Issue