[MERGE] MErged from main branch

bzr revid: vra@tinyerp.com-20100521091739-a6m659ghorwfg5c8
This commit is contained in:
vra 2010-05-21 14:47:39 +05:30
parent 7a397943e4
commit da9fc29dbc
98 changed files with 5528 additions and 1317 deletions

View File

@ -42,7 +42,7 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', c),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
_order = 'date'

View File

@ -630,7 +630,7 @@ class account_bank_statement_line(osv.osv):
'statement_id': fields.many2one('account.bank.statement', 'Statement',
select=True, required=True, ondelete='cascade'),
'reconcile_id': fields.many2one('account.bank.statement.reconcile',
'Reconcile', states={'confirm':[('readonly',True)]}),
'Reconcile'),
'move_ids': fields.many2many('account.move',
'account_bank_statement_line_move_rel', 'move_id','statement_id',
'Moves'),

View File

@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-03-15 03:12+0000\n"
"PO-Revision-Date: 2010-05-20 07:09+0000\n"
"Last-Translator: Songpon Phusing <p.songpon@gmail.com>\n"
"Language-Team: Thai <th@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-04-17 04:08+0000\n"
"X-Launchpad-Export-Date: 2010-05-21 03:38+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@ -51,7 +51,7 @@ msgstr ""
#. module: account
#: model:account.account.type,name:account.account_type_asset
msgid "Asset"
msgstr ""
msgstr "สินทรัพย์"
#. module: account
#: constraint:ir.actions.act_window:0
@ -106,7 +106,7 @@ msgstr ""
#: model:ir.actions.wizard,name:account.wizard_vat_declaration
#: model:ir.ui.menu,name:account.menu_wizard_vat_declaration
msgid "Print Taxes Report"
msgstr ""
msgstr "พิมพ์รายงานภาษี"
#. module: account
#: field:account.account,parent_id:0
@ -2133,7 +2133,8 @@ msgid "Analytic Entry"
msgstr ""
#. module: account
#: view:res.company:0 field:res.company,overdue_msg:0
#: view:res.company:0
#: field:res.company,overdue_msg:0
msgid "Overdue Payments Message"
msgstr ""

View File

@ -50,8 +50,10 @@
'wizard/auction_payer_sel_view.xml',
'wizard/auction_lots_sms_send_view.xml',
'wizard/auction_catalog_flagey_view.xml',
# 'wizard/auction_aie_send_view.xml',
# 'wizard/auction_aie_send_result_view.xml',
'wizard/auction_lots_buyer_map_view.xml',
# 'wizard/auction_lots_numerotate_view.xml',
'auction_view.xml',
'auction_report.xml',

View File

@ -31,8 +31,10 @@ import auction_lots_sms_send
import auction_catalog_flagey_report
#import auction_lots_cancel
#import auction_transfer_unsold_object
#import auction_aie_send
#import auction_aie_send_result
import auction_lots_buyer_map
#import auction_lots_numerotate
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,223 @@
# -*- 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/>.
#
##############################################################################
#
# Does not properly work concurrently !!!
#
import base64
import mimetypes
import httplib
import threading
from tools.translate import _
from osv import fields,osv
class auction_lots_send_aie(osv.osv_memory):
_name = 'auction.lots.send.aie'
_descritption = 'Send to website'
def _date_get(self, cr, uid, context={}):
selection = context and context.get('selection')
if selection:
return [('','')] + selection
return [('','')]
_columns = {
'uname': fields.char('Login', size=64),
'password': fields.char('Password', size=64),
'objects': fields.integer('# of objects', readonly=True),
'lang': fields.selection([('fr','fr'),('ned','ned'),('eng','eng'),('de','de')],'Language'),
'numerotation': fields.selection([('prov','Provisoire'),('definite','Definitive (ordre catalogue)')],'Numerotation'),
'dates': fields.selection(_date_get,'Auction Date'),
'img_send': fields.boolean('Send Image also ?'),
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
if 'password' in fields and context.get('password',False):
res['password'] = context.get('password')
return res
def _catalog_send(uname, passwd, lang, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog.cgi", (('uname',uname),('password',passwd),('did',did),('lang',lang)),(('file',catalog),))
def _photo_bin_send(uname, passwd, ref, did, photo_name, photo_data):
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key, filename, data) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(data)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/photo.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
def _photos_send(cr, uid, uname, passwd, did, ids):
service = netsvc.LocalService("object_proxy")
for (ref,id) in ids:
# ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)])
datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image'])
if len(datas):
bin = base64.decodestring(datas[0]['image'])
fname = datas[0]['name']
_photo_bin_send(uname, passwd, ref, did, fname, bin)
def get_dates(self, cr, uid, ids, context={}):
import httplib
data_obj = self.pool.get('ir.model.data')
conn = httplib.HTTPConnection('www.auction-in-europe.com')
datas = self.read(cr, uid, ids[0],['uname','password'])
conn.request("GET", "/aie_upload/dates_get.php?uname=%s&passwd=%s" % (datas['uname'], datas['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1','replace').encode('utf-8','replace')))
context['selection'] = map(_date_decode, response.read().split('\n'))
self._date_get(cr, uid, context=context)
else:
raise osv.except_osv(_('Error'), _("Connection to WWW.Auction-in-Europe.com failed !"))
id1 = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_send')
res_id = data_obj.browse(cr, uid, id1, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.send.aie',
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def _send(self, cr, uid, ids, context={}):
import pickle, thread, sql_db
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
cr.close()
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
lots_ids = []
datas = self.read(cr, uid, ids[0],['uname','login','lang','numerotation','dates'])
for l in lots:
if datas['numerotation']=='prov':
l['ref']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
else:
l['ref']='%04d' % (l['obj_num'],)
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
if l['artist_id']:
l['artist_id'] = l['artist_id'][1]
else:
l['artist_id'] = ''
for n in ('obj_desc','artist_id','lot_type'):
try:
l[n]=l[n].decode('utf-8','replace').encode('latin1','replace')
except:
l[n]=''
del l['lot_num']
del l['obj_num']
del l['bord_vnd_id']
l['aie_categ'] = vals.get(l['lot_type'], False)
lots_ids.append((l['ref'], l['id']))
args = pickle.dumps(lots)
thread.start_new_thread(_catalog_send, (datas['uname'],datas['password'],datas['lang'],datas['dates'], args))
if(datas['form']['img_send']==True):
thread.start_new_thread(_photos_send, (cr.dbname, uid, datas['uname'], datas['password'],datas['dates'], lots_ids))
return {}
def send_pdf(self, cr, uid, ids, context):
threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
auction_lots_send_aie()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,139 @@
# -*- 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/>.
#
##############################################################################
#
# Does not properly work concurrently !!!
#
import netsvc
from tools.translate import _
from osv import fields, osv
class auction_lots_pay(osv.osv_memory):
_name = 'auction.lots.send.aie.results'
_description = 'Send results to Auction-in-europe.com'
def _date_get(self, cr, uid, context={}):
selection = context and context.get('selection')
if selection:
return [('','')] + selection
return [('','')]
_columns = {
'uname': fields.char('Login', size=64),
'password': fields.char('Password', size=64),
'objects': fields.integer('# of objects'),
'dates': fields.selection(_date_get,'Auction Date'),
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
if 'password' in fields and context.get('password',False):
res['password'] = context.get('password')
return res
def _catalog_send(self, uname, passwd, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog_result.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def get_dates(self, cr, uid, ids, context):
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
data_obj = self.pool.get('ir.model.data')
datas = self.read(cr, uid, ids[0],['uname','password'])
conn.request("GET", "/aie_upload/dates_get_result.php?uname=%s&passwd=%s" % (datas['uname'], datas['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1').encode('utf-8')))
context['selection'] = map(_date_decode, response.read().split('\n'))
self._date_get(cr, uid, context=context)
else:
raise osv.except_osv(_('Error'),
_("Connection to WWW.Auction-in-Europe.com failed !"))
id1 = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_send_result_send')
res_id = data_obj.browse(cr, uid, id1, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.send.aie.results',
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def send(self, cr, uid, ids, context):
import pickle
service = netsvc.LocalService("object_proxy")
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','obj_price'])
args = pickle.dumps(lots)
self._catalog_send(datas['uname'], datas['password'], datas['dates'], args)
return {}
auction_lots_pay()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Auction lots send result -->
<record id="view_auction_lots_send_result_login" model="ir.ui.view">
<field name="name">Auction lots send result - Login</field>
<field name="model">auction.lots.send.aie.results</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname"/>
<newline/>
<field name="password" password="True"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="get_dates" string="Continue"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Send results to Auction-in-europe.com"
res_model="auction.lots.send.aie.results"
src_model="auction.lots"
view_mode="form"
view_id="view_auction_lots_send_result_login"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_send_result_login"/>
<record id="view_auction_lots_send_result_send" model="ir.ui.view">
<field name="name">Auction lots send result - Send</field>
<field name="model">auction.lots.send.aie.results</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname" readonly="1"/>
<field name="password" password="True" readonly="1"/>
<newline/>
<field name="objects" readonly="1"/>
<newline/>
<field name="dates" colspan="3"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="send" string="Send on your website"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Auction lots send result -->
<record id="view_auction_lots_send_login" model="ir.ui.view">
<field name="name">Auction lots send - Login</field>
<field name="model">auction.lots.send.aie</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname"/>
<newline/>
<field name="password" password="True"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="get_dates" string="Continue"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Send to website"
res_model="auction.lots.send.aie"
src_model="auction.lots"
view_mode="form"
view_id="view_auction_lots_send_login"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_send_login"/>
<record id="view_auction_lots_send" model="ir.ui.view">
<field name="name">Auction lots - Send</field>
<field name="model">auction.lots.send.aie</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname" readonly="1"/>
<field name="password" password="True" readonly="1"/>
<newline/>
<field name="objects"/>
<field name="lang"/>
<field name="numerotation"/>
<field name="img_send"/>
<newline/>
<field name="dates" colspan="3"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="send_pdf" string="Send on your website"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,184 @@
# -*- 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 netsvc
import sql_db
from osv import osv, fields
from tools.translate import _
class auction_lots_numerotate_per_lot(osv.osv_memory):
_name = 'auction.lots.numerotate'
_description = 'Numerotation (per lot)'
_columns = {
'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
'lot_num': fields.integer('Inventory Number', readonly=True),
'lot_est1': fields.float('Minimum Estimation', readonly=True),
'lot_est2': fields.float('Maximum Estimation', readonly=True),
'name': fields.char('Short Description', size=64, readonly=True),
'obj_desc': fields.text('Description', readonly=True),
'obj_num': fields.integer('Catalog Number', required=True)
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context)
active_id = context.get('active_id',False)
active_model = context.get('active_model')
if active_id and (active_model and active_model!='auction.lots'):
return res
lots_obj = self.pool.get('auction.lots')
lots = lots_obj.browse(cr, uid, active_id)
if 'bord_vnd_id' in fields and context.get('bord_vnd_id',False):
res['bord_vnd_id'] = context.get('bord_vnd_id')
if 'lot_num' in fields and context.get('lot_num',False):
res['lot_num'] = context.get('lot_num')
if 'lot_est1' in fields:
res['lot_est1'] = lots.lot_est1
if 'lot_est2' in fields:
res['lot_est2'] = lots.lot_est2
if 'name' in fields:
res['name'] = lots.name
if 'obj_desc' in fields:
res['obj_desc'] = lots.obj_desc
if 'obj_num' in fields:
res['obj_num'] = lots.obj_num
return res
def open_init_form(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_numerotate')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def numerotate(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
data_obj = self.pool.get('ir.model.data')
lots_obj = self.pool.get('auction.lots')
res = lots_obj.search(cr,uid,[('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('UserError', 'This record does not exist !')
lots_obj.write(cr, uid, found, {'obj_num':int(datas['obj_num'])} )
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_numerotate')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def read_record(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num'])
lots_obj = self.pool.get('auction.lots')
res = lots_obj.search(cr, uid, [('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('UserError', 'This record does not exist !')
lots_datas = lots_obj.read(cr, uid, found,
['obj_num', 'name', 'lot_est1',
'lot_est2', 'obj_desc'])
return lots_datas[0]
def test_exist(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num'])
res = self.pool.get('auction.lots').search(cr, uid,
[('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('Error', 'This lot does not exist !')
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_numerotate_second')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context' : context
}
auction_lots_numerotate_per_lot()
class auction_lots_numerotate(osv.osv_memory):
_name = 'auction.lots.numerotate_cont'
_description = 'Numerotation (automatic)'
_columns = {
'number': fields.integer('First Number', required=True)
}
def numerotate_cont(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['number'])
nbr = int(datas['number'])
lots_obj = self.pool.get('auction.lots')
rec_ids = lots_obj.browse(cr, uid, record_ids)
for rec_id in rec_ids:
lots_obj.write(cr, uid, [rec_id.id], {'obj_num':nbr})
nbr+=1
return {}
auction_lots_numerotate()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Numerotation (per lot) -->
<record id="view_auction_numerotate" model="ir.ui.view">
<field name="name">auction.lots.numerotate.open</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<separator string="Object Reference" colspan="4"/>
<field name="bord_vnd_id"/>
<newline/>
<field name="lot_num" readonly="False" required="True"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="test_exist" string="Continue"
colspan="2" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Numerotation (per lot)"
res_model="auction.lots.numerotate"
src_model="auction.lots"
view_id="view_auction_numerotate"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_numerotate"/>
<record id="view_auction_lots_numerotate_second" model="ir.ui.view">
<field name="name">auction.lots.numerotate.second</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<group>
<separator string="Object Reference" colspan="4"/>
<field name="bord_vnd_id" readonly="1"/>
<field name="lot_num" readonly="1"/>
<field name="name" readonly="1" colspan="3"/>
<field name="obj_desc" readonly="1" colspan="3"/>
<field name="lot_est1" readonly="1"/>
<field name="lot_est2" readonly="1"/>
<separator string="Object Reference" colspan="4"/>
<field name="obj_num"/>
</group>
<newline/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="open_init_form" string="Back" type="object"
icon="gtk-go-back"/>
<button name="numerotate" string="Numerotate"
type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<record id="action_auction_lots_numerotate" model="ir.actions.act_window">
<field name="name">Numerotation (per lot)</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">auction.lots.numerotate</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_auction_lots_numerotate_second"/>
<field name="target">new</field>
</record>
<record id="view_auction_numerotate_not_exist" model="ir.ui.view">
<field name="name">auction.lots.numerotate.not_exist</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation">
<label string="This lot does not exist !" colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="open_init_form" string="Retry" type="object"
icon="gtk-go-back"/>
</group>
</form>
</field>
</record>
<record id="action_auction_lots_numerotate_not_exist" model="ir.actions.act_window">
<field name="name">Numerotation - Not Exist</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">auction.lots.numerotate</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_auction_numerotate_not_exist"/>
<field name="target">new</field>
</record>
<record id="view_auction_numerotate_cont" model="ir.ui.view">
<field name="name">Numerotation (automatic)</field>
<field name="model">auction.lots.numerotate_cont</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<field name="number" colspan="4"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="numerotate_cont" string="Numerotation"
colspan="2" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Numerotation (automatic)"
res_model="auction.lots.numerotate_cont"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_auction_numerotate_cont"/>
</data>
</openerp>

View File

@ -1,232 +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/>.
#
##############################################################################
#
# Does not properly work concurently !!!
#
import pooler
import wizard
import netsvc
import base64
import mimetypes
import httplib
import threading
from tools.translate import _
login_form = '''<?xml version="1.0"?>
<form title="Login">
<field name="uname"></field>
<newline/>
<field name="password"></field>
</form>'''
send_form = '''<?xml version="1.0"?>
<form title="Selection">
<field name="uname"></field>
<field name="password"></field>
<newline/>
<field name="objects"></field>
<field name="lang"></field>
<field name="numerotation"></field>
<field name="img_send"></field>
<newline/>
<field name="dates" colspan="3"></field>
</form>'''
login_fields = {
'uname': {'string':'Login', 'type':'char'},
'password': {'string':'Password', 'type':'char'},
'numerotation': {'string':'Numerotation', 'type':'selection', 'selection':[('prov','Provisoire'),('definite','Definitive (ordre catalogue)')]},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
send_fields = {
'uname': {'string':'Login', 'type':'char', 'readonly':True},
'password': {'string':'Password', 'type':'char', 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'readonly':True},
'lang': {'string':'Langage', 'type':'selection', 'selection':[('fr','fr'),('ned','ned'),('eng','eng'),('de','de')]},
'numerotation': {'string':'Numerotation', 'type':'selection', 'selection':[('prov','Provisoire'),('definite','Definitive (ordre catalogue)')]},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]},
'img_send': {'string':'Send Image also ?', 'type':'boolean'}
}
def _catalog_send(uname, passwd, lang, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog.cgi", (('uname',uname),('password',passwd),('did',did),('lang',lang)),(('file',catalog),))
def _photo_bin_send(uname, passwd, ref, did, photo_name, photo_data):
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key, filename, data) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(data)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/photo.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
def _photos_send(cr,uid, uname, passwd, did, ids):
for (ref,id) in ids:
service = netsvc.LocalService("object_proxy")
# ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)])
datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image'])
if len(datas):
bin = base64.decodestring(datas[0]['image'])
fname = datas[0]['name']
_photo_bin_send(uname, passwd, ref, did, fname, bin)
def _get_dates(self,cr,uid, datas,context={}):
global send_fields
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
conn.request("GET", "/aie_upload/dates_get.php?uname=%s&passwd=%s" % (datas['form']['uname'], datas['form']['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1','replace').encode('utf-8','replace')))
send_fields['dates']['selection'] = map(_date_decode, response.read().split('\n'))
else:
raise wizard.except_wizard(_('Error'), _("Connection to WWW.Auction-in-Europe.com failed !"))
return {'objects':len(datas['ids'])}
def _send(self,db_name,uid, datas,context={}):
import pickle, thread, sql_db
#cr = pooler.get_db(cr.dbname).cursor()
# cr=sql_db.db.cursor()
cr = pooler.get_db(db_name).cursor()
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
cr.close()
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'], ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
ids = []
for l in lots:
if datas['form']['numerotation']=='prov':
l['ref']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
else:
l['ref']='%04d' % (l['obj_num'],)
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
if l['artist_id']:
l['artist_id'] = l['artist_id'][1]
else:
l['artist_id'] = ''
for n in ('obj_desc','artist_id','lot_type'):
try:
l[n]=l[n].decode('utf-8','replace').encode('latin1','replace')
except:
l[n]=''
del l['lot_num']
del l['obj_num']
del l['bord_vnd_id']
l['aie_categ'] = vals.get(l['lot_type'], False)
ids.append((l['ref'], l['id']))
args = pickle.dumps(lots)
thread.start_new_thread(_catalog_send, (datas['form']['uname'],datas['form']['password'],datas['form']['lang'],datas['form']['dates'], args))
if(datas['form']['img_send']==True):
thread.start_new_thread(_photos_send, (cr.dbname,uid, datas['form']['uname'],datas['form']['password'],datas['form']['dates'], ids))
return {}
def _send_pdf(self, cr, uid, data, context):
threaded_calculation = threading.Thread(target=_send, args=(self, cr.dbname, uid, data, context))
threaded_calculation.start()
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':login_form, 'fields': login_fields, 'state':[('date_ask','Continue'),('end','Cancel')]}
},
'date_ask': {
'actions': [_get_dates],
'result': {'type': 'form', 'arch':send_form, 'fields': send_fields, 'state':[('send','Send on your website'),('end','Cancel')]}
},
'send': {
'actions': [_send_pdf],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_pay('auction.lots.send.aie');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,137 +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/>.
#
##############################################################################
#
# Does not properly work concurently !!!
#
import wizard
import netsvc
from tools.translate import _
login_form = '''<?xml version="1.0"?>
<form title="Login">
<field name="uname"></field>
<newline/>
<field name="password"></field>
</form>'''
send_form = '''<?xml version="1.0"?>
<form title="Selection">
<field name="uname"></field>
<field name="password"></field>
<newline/>
<field name="objects"></field>
<newline/>
<field name="dates" colspan="3"></field>
</form>'''
login_fields = {
'uname': {'string':'Login', 'type':'char'},
'password': {'string':'Password', 'type':'char'},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
send_fields = {
'uname': {'string':'Login', 'type':'char', 'readonly':True},
'password': {'string':'Password', 'type':'char', 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'readonly':True},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
def _catalog_send(uname, passwd, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog_result.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def _get_dates(self,cr,uid, datas, context):
global send_fields
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
conn.request("GET", "/aie_upload/dates_get_result.php?uname=%s&passwd=%s" % (datas['form']['uname'], datas['form']['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1').encode('utf-8')))
send_fields['dates']['selection'] = map(_date_decode, response.read().split('\n'))
else:
raise wizard.except_wizard(_('Error'),
_("Connection to WWW.Auction-in-Europe.com failed !"))
return {'objects':len(datas['ids'])}
def _send(self,cr,uid, datas, context):
import pickle
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price'])
args = pickle.dumps(lots)
_catalog_send(datas['form']['uname'],datas['form']['password'], datas['form']['dates'], args)
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':login_form, 'fields': login_fields, 'state':[('date_ask','Continue'),('end','Cancel')]}
},
'date_ask': {
'actions': [_get_dates],
'result': {'type': 'form', 'arch':send_form, 'fields': send_fields, 'state':[('send','Send on your website'),('end','Cancel')]}
},
'send': {
'actions': [_send],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_pay('auction.lots.send.aie.results');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,154 +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 wizard
import netsvc
import pooler
import sql_db
numerotate_form_cont = '''<?xml version="1.0"?>
<form title="%s">
<field name="number" string="%s"/>
</form>''' % ('Continuous Numerotation','First Number')
numerotate_fields_cont = {
'number': {'string':'First Number', 'type':'integer', 'required':True}
}
numerotate_not_exist = '''<?xml version="1.0"?>
<form title="%s">
<label string="This lot does not exist !" colspan="4"/>
</form>''' % ('Catalog Numerotation',)
numerotate_form = '''<?xml version="1.0"?>
<form title="%s">
<separator string="%s" colspan="4"/>
<field name="bord_vnd_id"/>
<newline/>
<field name="lot_num"/>
</form>''' % ('Catalog Numerotation','Object Reference')
numerotate_fields = {
'bord_vnd_id': {'string':'Depositer Inventory', 'type':'many2one', 'required':True, 'relation':'auction.deposit'},
'lot_num': {'string':'Lot Number', 'type':'integer', 'required':True},
}
numerotate_form2 = '''<?xml version="1.0"?>
<form title="%s">
<group>
<separator string="%s" colspan="4"/>
<field name="bord_vnd_id" readonly="1"/>
<field name="lot_num" readonly="1"/>
<field name="name" readonly="1" colspan="3"/>
<field name="obj_desc" readonly="1" colspan="3"/>
<field name="lot_est1" readonly="1"/>
<field name="lot_est2" readonly="1"/>
<separator string="%s" colspan="4"/>
<field name="obj_num"/>
</group>
</form>''' % ('Catalog Numerotation','Object Reference','Object Reference')
numerotate_fields2 = {
'bord_vnd_id': {'string':'Object Inventory', 'type':'many2one', 'relation':'auction.deposit', 'readonly':True},
'lot_num': {'string':'Inventory Number', 'type':'integer', 'readonly':True},
'lot_est1': {'string':'Minimum Estimation', 'type':'float', 'readonly':True},
'lot_est2': {'string':'Maximum Estimation', 'type':'float', 'readonly':True},
'name': {'string':'Short Description', 'type':'char', 'size':64, 'readonly':True},
'obj_desc': {'string':'Description', 'type':'text', 'readonly':True},
'obj_num': {'string':'Catalog Number', 'type':'integer', 'required':True}
}
def _read_record(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
raise wizard.except_wizard('UserError', 'This record does not exist !')
datas = pooler.get_pool(cr.dbname).get('auction.lots').read(cr,uid,found,['obj_num', 'name', 'lot_est1', 'lot_est2', 'obj_desc'])
return datas[0]
def _test_exist(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
return 'not_exist'
return 'search'
def _numerotate(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
raise wizard.except_wizard('UserError', 'This record does not exist !')
pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,found,{'obj_num':int(form['obj_num'])} )
return {'lot_inv':'', 'lot_num':''}
def _numerotate_cont(self,cr,uid,datas,context={}):
nbr = int(datas['form']['number'])
refs = pooler.get_pool(cr.dbname).get('auction.lots')
rec_ids = refs.browse(cr,uid,datas['ids'])
for rec_id in rec_ids:
refs.write(cr,uid,[rec_id.id],{'obj_num':nbr})
nbr+=1
return {}
class wiz_auc_lots_numerotate(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_form, 'fields': numerotate_fields, 'state':[('end','Cancel'),('choice','Continue')]}
},
'search': {
'actions': [_read_record],
'result': {'type': 'form', 'arch':numerotate_form2, 'fields': numerotate_fields2, 'state':[('end','Exit'),('init','Back'),('set_number','Numerotate')]}
},
'choice' : {
'actions' : [],
'result' : {'type' : 'choice', 'next_state': _test_exist }
},
'not_exist' : {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_not_exist, 'fields': {}, 'state':[('end','Exit'),('init','Retry')]}
},
'set_number': {
'actions': [_numerotate],
'result': {'type': 'state', 'state':'init'}
}
}
wiz_auc_lots_numerotate('auction.lots.numerotate');
class wiz_auc_lots_numerotate(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_form_cont, 'fields': numerotate_fields_cont, 'state':[('end','Exit'),('set_number','Numerotation')]}
},
'set_number': {
'actions': [_numerotate_cont],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_numerotate('auction.lots.numerotate_cont');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -103,7 +103,7 @@ class crm_lead(osv.osv, crm_case):
'email_cc': fields.text('Watchers Emails', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'description': fields.text('Description'),
'description': fields.text('Notes'),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
@ -137,7 +137,7 @@ and users by email"),
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
}
}
_defaults = {
'active': lambda *a: 1,

View File

@ -39,6 +39,7 @@
'partner_view.xml'
],
'demo_xml': ['delivery_demo.xml'],
'test':['test/delivery_test.yml',],
'installable': True,
'active': False,
'certificate': '0033981912253',

View File

@ -0,0 +1,155 @@
-
In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method
And there are two methods for doing that
Delivery based on order quantities,
Delivery based on delivered quantities.
-
I create the partner associated with the transport.
-
I create partner.
-
!record {model: res.partner, id: res_partner_thepost0}:
address:
- country_id: base.in
name: Micro Link
credit_limit: 0.0
name: The Post
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
I create associated product for delivery.
-
!record {model: product.product, id: product_product_deliverybypost0}:
categ_id: product.product_category_services
cost_method: standard
mes_type: fixed
name: Delivery Product
procure_method: make_to_stock
supply_method: buy
type: service
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
warranty: 0.0
-
I create the Delivery Method.
-
!record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}:
name: The OpenERP Experss
partner_id: res_partner_thepost0
product_id: product_product_deliverybypost0
-
I create a delivery grid record and define the region for which the tariffs in the grid will be applicable.
Then set the condition for which this rule is applicable.
-
!record {model: delivery.grid, id: delivery_grid_weight0}:
carrier_id: delivery_carrier_theopenerpexperss0
line_ids:
- list_price: 120.0
max_value: 250.0
name: Weight of product
operator: <=
standard_price: 60.0
type: weight
price_type: fixed
variable_factor: weight
- list_price: 0.0
max_value: 500.0
name: Price &gt;= 500
operator: <=
standard_price: 20.0
type: price
price_type: fixed
variable_factor: weight
country_ids:
- base.id
- base.be
- base.in
- base.io
name: Weight
sequence: 1
-
To check the Delivery based on order quantities , I have created sale order and picking_policy is direct .
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-11'
invoice_quantity: order
name: Test/delivery
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I create delivery.sale.order record.
-
!record {model: delivery.sale.order, id: delivery_sale_order_0}:
carrier_id: delivery_carrier_theopenerpexperss0
-
To add the delivery charges on the quotation, I click on Delivery costs button and select the carrier.
-
!python {model: delivery.sale.order}: |
self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model":
"sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")],
"active_id": ref("sale_order_so0"), })
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
To check the Invoicing based on deliveries.I create new sale order and picking_policy is Complete Delivery.
-
!record {model: sale.order, id: sale_order_test_complete0}:
name: Test/Complete Deliver
carrier_id: delivery.delivery_carrier_theopenerpexperss0
invoice_quantity: procurement
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
partner_id: base.res_partner_4
partner_order_id: base.res_partner_address_7
partner_invoice_id: base.res_partner_address_7
partner_shipping_id: base.res_partner_address_7
pricelist_id: product.list0
order_policy: picking
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0}
-
I Create stock.invoice.onshipping
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
journal_id: account.sales_journal
type: out_invoice
-
I Create Invoice form picking.
-
!python {model: stock.invoice.onshipping}: |
so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0'))
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "active_model": "stock.picking", "contact_display": "partner",
"active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id })

View File

@ -36,6 +36,8 @@
'init_xml': [],
'update_xml': [
'marketing_campaign_view.xml',
'marketing_campaign_data.xml',
'marketing_campaign_workflow.xml',
'report/campaign_analysis_view.xml',
],
'demo_xml': [],

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ==================Marketing Campaigns================== -->
<record id="wkf_marketing_campaign" model="workflow">
<field name="name">marketing.campaign.basic</field>
<field name="osv">marketing.campaign</field>
<field name="on_create">True</field>
</record>
<!-- Activity -->
<record id="act_marketing_campaign_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_marketing_campaign_running" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">running</field>
<field name="kind">function</field>
<field name="action">state_running_set()</field>
</record>
<record id="act_marketing_campaign_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">done</field>
<field name="kind">function</field>
<field name="action">state_done_set()</field>
</record>
<record id="act_marketing_campaign_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">cancel</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
<field name="action">state_cancel_set()</field>
</record>
<!-- Transition -->
<record id="trans_marketing_campaign_draft_running" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_draft"/>
<field name="act_to" ref="act_marketing_campaign_running"/>
<field name="signal">state_running_set</field>
</record>
<record id="trans_campaign_running_done" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_running"/>
<field name="act_to" ref="act_marketing_campaign_done"/>
<field name="signal">state_done_set</field>
</record>
<record id="trans_campaign_running_cancel" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_running"/>
<field name="act_to" ref="act_marketing_campaign_cancel"/>
<field name="signal">state_cancel_set</field>
</record>
<!-- ==================Marketing Campaign Segment================== -->
<record id="wkf_marketing_campaign_segment" model="workflow">
<field name="name">marketing.campaign.segment.basic</field>
<field name="osv">marketing.campaign.segment</field>
<field name="on_create">True</field>
</record>
<!-- Activity -->
<record id="act_marketing_campaign_segment_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_marketing_campaign_segment_running" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">running</field>
<field name="kind">function</field>
<field name="action">state_running_set()</field>
</record>
<record id="act_marketing_campaign_segment_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">done</field>
<field name="kind">function</field>
<field name="action">state_done_set()</field>
</record>
<record id="act_marketing_campaign_segment_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">cancel</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
<field name="action">state_cancel_set()</field>
</record>
<!-- Transition -->
<record id="trans_marketing_campaign_segment_draft_running" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_draft"/>
<field name="act_to" ref="act_marketing_campaign_segment_running"/>
<field name="signal">state_running_set</field>
</record>
<record id="trans_campaign_segment_running_done" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_running"/>
<field name="act_to" ref="act_marketing_campaign_segment_done"/>
<field name="signal">state_done_set</field>
</record>
<record id="trans_campaign_segment_running_cancel" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_running"/>
<field name="act_to" ref="act_marketing_campaign_segment_cancel"/>
<field name="signal">state_cancel_set</field>
</record>
</data>
</openerp>

View File

@ -77,7 +77,11 @@
'report/mrp_production_order_view.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
# 'test': ['test/mrp_phantom_bom.yml','test/mrp_production_order.yml'],
'test': [
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
'test/mrp_procurement.yml'
],
'installable': True,
'active': False,
'certificate': '0032052481373',

View File

@ -166,7 +166,7 @@
<field name="arch" type="xml">
<tree string="Routing Work Centers">
<field name="sequence"/>
<field name="workcenter_id" select="1"/>
<field name="workcenter_id"/>
<field name="cycle_nbr"/>
<field name="hour_nbr"/>
</tree>
@ -249,7 +249,7 @@
<newline/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="routing_id" groups="base.group_extended"/>
<field name="routing_id" groups="base.group_extended" select="1"/>
<newline/>
<field name="product_uos" groups="product.group_uos"/>
<field name="product_uos_qty" groups="product.group_uos"/>
@ -471,10 +471,10 @@
<field name="arch" type="xml">
<form string="Manufacturing Orders">
<group colspan="4" col="6">
<field name="name" select="1" string="Reference"/>
<field name="date_planned" select="1"/>
<field name="origin" select="1"/>
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
<field name="name" string="Reference"/>
<field name="date_planned"/>
<field name="origin"/>
<field name="product_id" on_change="product_id_change(product_id)"/>
<field name="product_qty"/>
<group colspan="2" col="3">
<field name="product_uom"/>
@ -493,7 +493,7 @@
<notebook colspan="4">
<page string="Consumed Products">
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]" on_change="bom_id_change(bom_id)"/>
<field name="routing_id" groups="base.group_extended" select="1"/>
<field name="routing_id" groups="base.group_extended"/>
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)"/>
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
<separator string="" colspan="4"/>
@ -592,8 +592,8 @@
<page string="Work Orders" groups="base.group_extended">
<field colspan="4" name="workcenter_lines" nolabel="1">
<form string="Production Work Centers">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="workcenter_id" select="1"/>
<field colspan="4" name="name"/>
<field colspan="4" name="workcenter_id"/>
<field name="sequence"/>
<field name="cycle"/>
<field name="hour"/>
@ -611,7 +611,7 @@
<field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/>
</page>
<page string="Extra Information">
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="priority" groups="base.group_extended"/>
<newline/>
<field name="date_start"/>
@ -636,8 +636,7 @@
<filter icon="terp-mrp" string="Draft"
domain="[('state','=','draft')]"
help="Non confirmed manufacturing orders"/>
<filter icon="terp-mrp" string="Current"
default="1"
<filter icon="terp-mrp" name="current" string="Current"
domain="[('state','in',('confirmed','ready'))]"
help="Manufacturing Orders which are waiting for raw materials"/>
<filter icon="terp-mrp" string="Ready"
@ -674,6 +673,7 @@
<field name="res_model">mrp.production</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt</field>
<field name="context">{'search_default_current':1}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_mrp_production_filter"/>
</record>
@ -799,6 +799,7 @@
</xpath>
</field>
</record>
<act_window
id="action_product_bom_structure"
name="Product BoM Structure"

View File

@ -113,8 +113,9 @@
<field name="act_to" ref="prod_act_cancel"/>
<field name="signal">button_cancel</field>
</record>
<!-- Procurement -->
<record id="act_produce" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce</field>
@ -122,41 +123,9 @@
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
<field name="action">action_produce_assign_product()</field>
</record>
<record id="act_produce_check" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce_check</field>
</record>
<record id="act_produce_service" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce_service</field>
<field name="kind">function</field>
<field name="action">action_produce_assign_service()</field>
</record>
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
<field name="act_from" ref="mrp_procurement.act_confirm_mto"/>
<field name="act_to" ref="act_produce_check"/>
<field name="condition">check_produce()</field>
</record>
<record id="trans_product_check_produce_service" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_to" ref="act_produce_service"/>
<field name="condition">not check_product()</field>
</record>
<record id="trans_produce_service_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_service_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
</record>
<record id="trans_product_check_produce" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_from" ref="mrp_procurement.act_produce_check"/>
<field name="act_to" ref="act_produce"/>
<field name="condition">check_product()</field>
</record>

View File

@ -48,8 +48,8 @@
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter string="This Year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]" default="1" />
<filter string="This Month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
<filter string="This Year" name="this_year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" name="this_month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
<separator orientation="vertical"/>
@ -101,7 +101,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
<field name="context">{'search_default_Product': 1}</field>
<field name="context">{'search_default_Product': 1,'search_default_this_year':1,'search_default_this_month':1}</field>
</record>

View File

@ -135,19 +135,36 @@
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table10">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Text body" fontName="Helvetica" 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"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
@ -172,6 +189,7 @@
</stylesheet>
<images/>
<story>
<section>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]] </para>
<para style="terp_default_8">
<font color="white"> </font>
@ -313,7 +331,10 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_Bold_9">Products to Consume</para>
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table8">
<para> <font color="white"> [[ o.move_lines ==[] and removeParentNode('section')]]</font></para>
<tr>
<td>
<para style="terp_tblheader_Details">Product </para>
@ -329,9 +350,10 @@
</td>
</tr>
</blockTable>
</section>
<section>
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table9">
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
<tr>
<td>
<para style="terp_default_9">[[ line.product_id.code ]] [[ line.product_id.name ]]</para>
@ -350,9 +372,54 @@
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_Bold_9">Consumed Products</para>
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table7">
<para> <font color="white"> [[ o.move_lines2 ==[] and removeParentNode('section')]]</font></para>
<tr>
<td>
<para style="terp_tblheader_Details">Product </para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Quantity</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Source Location</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Destination Location</para>
</td>
</tr>
</blockTable>
</section>
<section>
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table10">
<para style="terp_default_8">[[ repeatIn(o.move_lines2,'line2') ]]</para>
<tr>
<td>
<para style="terp_default_9">[[ line2.product_id.code ]] [[ line2.product_id.name ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang( line2.product_qty) ]] </para>
</td>
<td>
<para style="terp_default_9">[[line2.product_uom.name]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line2.location_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line2.location_dest_id.name ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
</story>
</document>
</document>

View File

@ -2,7 +2,7 @@
In order to test the mrp phantom bom type in OpenERP, I will create products
and then I will create Phantom bom structure for those products.
-
I create the products required to produce some orange juices: Oranges, Sugar and Water.
I create the products required to produce some orange juices with Oranges, Sugar and Water.
-
!record {model: product.uom, id: product_uom_litre0}:
category_id: product.product_uom_categ_kgm
@ -129,7 +129,6 @@
date_planned: '2010-04-16 15:53:36'
location_dest_id: stock.stock_location_output
location_src_id: stock.stock_location_stock
name: MO/00002
product_id: product_product_orangejuice0
product_qty: 100.0
product_uom: product_uom_litre0
@ -171,7 +170,7 @@
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('origin','=',':MO/00002')])
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
@ -196,7 +195,7 @@
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003'])])
purch_ids = self.search(cr, uid, [('state','=','draft')])
assert purch_ids, _('No Purchase Orders were made!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
@ -207,7 +206,7 @@
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003']),('state','=','confirmed')])
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
@ -217,7 +216,7 @@
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
pick_ids = self.search(cr, uid, [('type','=','in')])
assert pick_ids, _('No Incoming Shipments found!')
-
I receive both the products. My incoming pickings are done.
@ -229,6 +228,7 @@
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
self.do_partial(cr, uid, [1],context={'active_ids': picking_ids})
picking_ids = pick_obj.search(cr, uid, [('type','=','in')])
self.view_init(cr, uid, ['date','partner_id','address_id'],context={'active_ids': picking_ids})
self.do_partial(cr, uid, [1], context={'active_ids': picking_ids})

View File

@ -0,0 +1,336 @@
-
In order to test the flow of procurement orders. I will put some orders with
different procurement methods. I have installed sale, mrp and purchase modules.
-
I am creating products.
-
Creating a product.product record
-
!record {model: product.product, id: product_product_shirt0}:
categ_id: product.cat1
cost_method: standard
list_price: 350.0
mes_type: fixed
name: Shirt
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 300.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
-
!record {model: product.product, id: product_product_cloth0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Cloth
procure_method: make_to_order
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_maxtor
qty: 300.0
standard_price: 1.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
-
!record {model: product.product, id: product_product_buttons0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Buttons
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 100.0
standard_price: 1.0
supply_method: buy
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
I am creating bills of material for 'Shirt'.
-
Creating a mrp.bom record
-
!record {model: mrp.bom, id: mrp_bom_shirt0}:
bom_lines:
- company_id: base.main_company
name: Cloth
product_efficiency: 1.0
product_id: product_product_cloth0
product_qty: 1.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
- company_id: base.main_company
name: Buttons
product_efficiency: 1.0
product_id: product_product_buttons0
product_qty: 8.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
company_id: base.main_company
name: Shirt
product_efficiency: 1.0
product_id: product_product_shirt0
product_qty: 1.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
-
I create minimum stock rule for product Buttons
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
name: OP/00007
product_id: mrp.product_product_buttons0
product_max_qty: 50.0
product_min_qty: 10.0
product_uom: product.product_uom_unit
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I create a procurement order for product Shirt.
-
!record {model: mrp.procurement, id: mrp_procurement_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
location_id: stock.stock_location_stock
product_uom: product.product_uom_unit
-
I confirm the procurement order.
-
!workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
-
I run the procurement.
-
!workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0'))])
assert order_ids, 'No Manufacturing Order.'
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
assert proc_ids, 'No Procurements.'
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[]"
-
I check that there is one purchase order for Cloth.
-
!python {model: purchase.order}: |
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
assert purch_ids, 'No Purchase Orders.'
-
I confirm purchase order for Cloth.
-
!python {model: purchase.order}: |
import netsvc
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
-
I get the approval from the supplier. So I approve my purchase orders.
-
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
-
I confirm purchase order for Buttons.
-
!python {model: purchase.order}: |
import netsvc
purch_ids = self.search(cr, uid, [('partner_id.name','=','ASUStek')])
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
-
I get the approval from the supplier. So I approve my purchase orders.
-
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
-
I Check incoming shipments for cloth. And receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
partial = self.browse(cr, uid, 1, context)
partial_datas = {
'partner_id' : partial.partner_id and partial.partner_id.id or False,
'address_id' : partial.address_id and partial.address_id.id or False,
'delivery_date' : partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
for m in pick.move_lines:
partial_datas['move%s'%(m.id)] = {
'product_id' : m.product_id.id,
'product_qty' : m.product_qty,
'product_uom' : m.product_uom.id
}
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
partial_datas['move%s'%(m.id)].update({
'product_price' : m.product_price,
'product_currency': m.product_currency
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
I Check incoming shipments for buttons. And receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
partial = self.browse(cr, uid, 1, context)
partial_datas = {
'partner_id': partial.partner_id and partial.partner_id.id or False,
'address_id': partial.address_id and partial.address_id.id or False,
'delivery_date': partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
for m in pick.move_lines:
partial_datas['move%s'%(m.id)] = {
'product_id': m.product_id.id,
'product_qty': m.product_qty,
'product_uom': m.product_uom.id
}
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
partial_datas['move%s'%(m.id)].update({
'product_price': m.product_price,
'product_currency': m.product_currency
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
Run scheduler again.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[]"
-
Check state of manufacturing order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0')),('state','=','ready')])
assert order_ids, 'No Manufacturing Order in Ready state.'
-
I start production order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
import netsvc
prod_ids = self.search(cr, uid, [('state','=','ready')])
assert prod_ids, _('No Ready Manufacturing Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in prod_ids:
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
!record {model: stock.move.consume, id: stock_move_consume0}:
product_id: product_product_buttons0
product_qty: 35.00
product_uom: product.product_uom_unit
location_id: stock.stock_location_stock
-
!python {model: stock.move.consume}: |
from tools.translate import _
stock_obj = self.pool.get('stock.move')
stock_ids = stock_obj.search(cr, uid, [('product_id.name','=','Buttons')])
self.do_move_consume(cr, uid, [1], context={'active_ids': stock_ids})
-
And finally production order is done.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})

View File

@ -86,27 +86,27 @@
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('origin','=',':MO/00004')])
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('origin','=',':MO/00004')]"
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the subproduct of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','ready')])
order_ids = self.search(cr, uid, [('state','=','confirmed')])
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
@ -117,7 +117,7 @@
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('origin','=',':MO/00004')])
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
@ -125,7 +125,7 @@
-
!python {model: mrp.production}: |
from tools.translate import _
prod_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','done')])
prod_ids = self.search(cr, uid, [('state','!=','done')])
assert prod_ids, _('Manufacturing order is yet not done!')
-
I start producing the product PC1.

View File

@ -29,20 +29,20 @@
<form string="Procurement">
<group col="2" colspan="2">
<separator colspan="2" string="References"/>
<field name="name" select="1" string="Procurement Reason"/>
<field name="name" string="Procurement Reason"/>
<field name="origin"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Planification"/>
<field name="date_planned" select="1"/>
<field name="date_planned"/>
<field name="procure_method"/>
<field name="priority" groups="base.group_extended"/>
</group>
<notebook colspan="4">
<page string="Procurement Details">
<separator colspan="4" string="Product &amp; Location"/>
<field name="product_id" select="1" on_change="onchange_product_id(product_id)"/>
<field name="product_id" on_change="onchange_product_id(product_id)"/>
<field name="location_id" domain="[('usage','=','internal')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
@ -85,7 +85,7 @@
<field name="arch" type="xml">
<search string="Search Procurement">
<group col='10' colspan='4'>
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" default="1" help="Procurement Orders in draft or open state."/>
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" name="current" help="Procurement Orders in draft or open state."/>
<filter icon="terp-mrp" string="Exceptions" domain="[('state','=','exception')]" help="Procurement Orders with exceptions"/>
<filter icon="terp-mrp" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
@ -112,6 +112,7 @@
<field name="res_model">mrp.procurement</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_mrp_procurement_filter"/>
</record>
@ -179,11 +180,11 @@
<field name="arch" type="xml">
<search string="Minimum Stock Rules Search">
<group col="10" colspan="4">
<field name="name" select="1" />
<field name="warehouse_id" select="1" widget="selection"/>
<field name="location_id" select="1" />
<field name="company_id" select="1" widget="selection"/>
<field name="product_id" select="1"/>
<field name="name"/>
<field name="warehouse_id" widget="selection"/>
<field name="location_id"/>
<field name="company_id" widget="selection"/>
<field name="product_id"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">

View File

@ -2,8 +2,6 @@
<openerp>
<data>
<!-- Procurement -->
<record id="wkf_procurement" model="workflow">
<field name="name">mrp.procurement.basic</field>
<field name="osv">mrp.procurement</field>
@ -48,16 +46,16 @@
<field name="kind">function</field>
<field name="action">action_move_assigned()</field>
</record>
<!-- <record id="act_produce_check" model="workflow.activity">-->
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
<!-- <field name="name">produce_check</field>-->
<!-- </record>-->
<!-- <record id="act_produce_service" model="workflow.activity">-->
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
<!-- <field name="name">produce_service</field>-->
<!-- <field name="kind">function</field>-->
<!-- <field name="action">action_produce_assign_service()</field>-->
<!-- </record>-->
<record id="act_produce_check" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">produce_check</field>
</record>
<record id="act_produce_service" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">produce_service</field>
<field name="kind">function</field>
<field name="action">action_produce_assign_service()</field>
</record>
<record id="act_make_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">ready</field>
@ -155,16 +153,16 @@
<field name="act_to" ref="act_make_to_stock"/>
<field name="condition">check_make_to_stock()</field>
</record>
<!-- <record id="trans_confirm_mto_produce_check" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_confirm_mto"/>-->
<!-- <field name="act_to" ref="act_produce_check"/>-->
<!-- <field name="condition">check_produce()</field>-->
<!-- </record>-->
<!-- <record id="trans_product_check_produce_service" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_check"/>-->
<!-- <field name="act_to" ref="act_produce_service"/>-->
<!-- <field name="condition">not check_product()</field>-->
<!-- </record>-->
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
<field name="act_from" ref="act_confirm_mto"/>
<field name="act_to" ref="act_produce_check"/>
<field name="condition">check_produce()</field>
</record>
<record id="trans_product_check_produce_service" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_to" ref="act_produce_service"/>
<field name="condition">not check_product()</field>
</record>
<record id="trans_make_to_stock_make_done" model="workflow.transition">
<field name="act_from" ref="act_make_to_stock"/>
<field name="act_to" ref="act_make_done"/>
@ -172,15 +170,15 @@
<field name="trigger_model" eval="False"/>
<field name="trigger_expr_id" eval="False"/>
</record>
<!-- <record id="trans_produce_service_cancel" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_service"/>-->
<!-- <field name="act_to" ref="act_cancel"/>-->
<!-- <field name="signal">subflow.cancel</field>-->
<!-- </record>-->
<!-- <record id="trans_produce_service_make_done" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_service"/>-->
<!-- <field name="act_to" ref="act_make_done"/>-->
<!-- </record>-->
<record id="trans_produce_service_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_service_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="act_make_done"/>
</record>
<record id="trans_make_done_done" model="workflow.transition">
<field name="act_from" ref="act_make_done"/>
<field name="act_to" ref="act_done"/>

View File

@ -8,41 +8,45 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-12-08 11:46+0000\n"
"PO-Revision-Date: 2010-01-26 11:01+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"PO-Revision-Date: 2010-05-20 14:21+0000\n"
"Last-Translator: Christophe Chauvet - http://www.syleam.fr/ <Unknown>\n"
"Language-Team: French <fr@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-04-17 04:21+0000\n"
"X-Launchpad-Export-Date: 2010-05-21 03:38+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: multi_company
#: help:multi_company.default,object_id:0
msgid "Object affect by this rules"
msgstr ""
msgstr "Objet affecté par cette règle"
#. module: multi_company
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
"Le nom de l'objet doit commencer par x_ et ne doit pas contenir de "
"caractères spéciaux !"
#. module: multi_company
#: constraint:product.template:0
msgid ""
"Error: The default UOM and the purchase UOM must be in the same category."
msgstr ""
"Erreur: l'unité de mesure par défaut et l'unité de mesure d'achat doivent "
"faire partie de la même catégorie"
#. module: multi_company
#: constraint:res.partner:0
msgid "The VAT doesn't seem to be correct."
msgstr ""
msgstr "La TVA ne semble pas correcte"
#. module: multi_company
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr ""
msgstr "Nom de l'objet invalide dans l'action défini"
#. module: multi_company
#: model:res.company,overdue_msg:multi_company.res_company_odoo
@ -59,18 +63,18 @@ msgstr ""
#. module: multi_company
#: field:multi_company.default,company_dest_id:0
msgid "Default Company"
msgstr ""
msgstr "Société par défaut"
#. module: multi_company
#: field:multi_company.default,object_id:0
msgid "Object"
msgstr ""
msgstr "Objet"
#. module: multi_company
#: model:ir.module.module,shortdesc:multi_company.module_meta_information
#: view:multi_company.default:0
msgid "Multi Company"
msgstr ""
msgstr "Multi société"
#. module: multi_company
#: model:ir.module.module,description:multi_company.module_meta_information

View File

@ -75,6 +75,7 @@ Main features :
'statement_data.xml',
],
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml'],
'test':['test/pos_test.yml',],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -237,7 +237,7 @@ class pos_order(osv.osv):
'partner_id': False,
'invoice_id': False,
'account_move': False,
'last_out_picking': False,
'picking_id': False,
'nb_print': 0,
'pickings': []
})
@ -308,7 +308,7 @@ class pos_order(osv.osv):
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'account_move': fields.many2one('account.move', 'Account Entry', readonly=True),
'pickings': fields.one2many('stock.picking', 'pos_order', 'Picking', readonly=True),
'last_out_picking': fields.many2one('stock.picking', 'Last Output Picking', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Last Output Picking', readonly=True),
'first_name': fields.char('First Name', size=64),
'state_2': fields.function(_get_v,type='selection',selection=[('to_verify', 'To Verify'), ('accepted', 'Accepted'),
('refused', 'Refused')], string='State', readonly=True, method=True, store=True),
@ -349,6 +349,7 @@ class pos_order(osv.osv):
return False
_defaults = {
'user_salesman_id':lambda self, cr, uid, context: uid,
'user_id': lambda self, cr, uid, context: uid,
'sale_manager': lambda self, cr, uid, context: uid,
'state': lambda *a: 'draft',
@ -467,7 +468,7 @@ class pos_order(osv.osv):
orders = self.browse(cr, uid, ids, context)
for order in orders:
if not order.last_out_picking:
if not order.picking_id:
new = True
picking_id = picking_obj.create(cr, uid, {
'origin': order.name,
@ -479,9 +480,9 @@ class pos_order(osv.osv):
'auto_picking': True,
'pos_order': order.id,
})
self.write(cr, uid, [order.id], {'last_out_picking': picking_id})
self.write(cr, uid, [order.id], {'picking_id': picking_id})
else:
picking_id = order.last_out_picking.id
picking_id = order.picking_id.id
picking_obj.write(cr, uid, [picking_id], {'auto_picking': True})
picking = picking_obj.browse(cr, uid, [picking_id], context)[0]
new = False
@ -773,7 +774,8 @@ class pos_order(osv.osv):
comp_id=comp_id and comp_id.id or False
to_reconcile = []
group_tax = {}
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context).id
order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id
# Create an entry for the sale
@ -1088,13 +1090,14 @@ class pos_order_line(osv.osv):
'Please set one before choosing a product.'))
p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price
price = self.pool.get('product.pricelist').price_get(cr, uid,
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
if price is False:
raise osv.except_osv(_('No valid pricelist line found !'),
_("Couldn't find a pricelist line matching this product" \
" and quantity.\nYou have to change either the product," \
" the quantity or the pricelist."))
return price
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
# Todo need to check
# if price is False:
# raise osv.except_osv(_('No valid pricelist line found !'),
# _("Couldn't find a pricelist line matching this product" \
# " and quantity.\nYou have to change either the product," \
# " the quantity or the pricelist."))
return price or p_obj
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)

View File

@ -46,6 +46,7 @@
<field eval="&quot;&quot;&quot;en_US&quot;&quot;&quot;" name="context_lang"/>
<field eval="&quot;&quot;&quot;Shop 3&quot;&quot;&quot;" name="name"/>
<field name="company_id" ref="res_company_shop0"/>
<field name="company_ids" eval="[(4, ref('res_company_shop0'))]"/>
<field eval="&quot;&quot;&quot;shop3&quot;&quot;&quot;" name="login"/>
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
</record>

View File

@ -8,18 +8,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Order POS">
<notebook >
<page string="Order lines">
<group colspan="4" col="6">
<field name="user_salesman_id" />
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="contract_number" select="1" groups="base.group_extended"/>
</group>
<group col="6" colspan="4">
<field name="user_salesman_id" />
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="contract_number" groups="base.group_extended"/>
</group>
<notebook colspan="4">
<page string="Sale Order ">
<field name="lines" colspan="4" nolabel="1">
<tree string="Order lines" editable="bottom">
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275" />
<field name="qty" />
<field name="qty_rfd" />
<field name="qty_rfd" groups="base.group_extended"/>
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
<field name="price_unit" readonly="1"/>
@ -31,7 +32,7 @@
<form string="Order lines" >
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
<field name="qty" />
<field name="qty_rfd" />
<field name="qty_rfd" groups="base.group_extended"/>
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
<field name="price_unit"/>
@ -60,7 +61,7 @@
</group>
<separator colspan="4" string="Actions"/>
<group colspan="4" col="6">
<field name="state" select="1"/>
<field name="state"/>
<button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" />
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
@ -69,21 +70,21 @@
</group>
</page>
<page string="Payment">
<page string="Order and Payment">
<group colspan="2" col="2" name="Type">
<separator string="Order Information" colspan="4"/>
<field name="company_id"/>
<field name="shop_id" widget="selection" />
<field name="name" select="1"/>
<field name="name"/>
<field name="user_id" />
<field name="sale_manager" />
<field name="price_type" />
</group>
<group colspan="2" col="2" name="Type">
<separator string="Dates" colspan="4"/>
<field name="date_order" select="1" />
<field name="date_validation" select="1" />
<field name="date_payment" select="1" groups="base.group_extended"/>
<field name="date_order"/>
<field name="date_validation" />
<field name="date_payment" groups="base.group_extended"/>
</group>
<group colspan="4">
<separator string="Invoicing" colspan="4"/>
@ -135,12 +136,12 @@
<field name="arch" type="xml">
<tree string="POS Orders">
<field name="name"/>
<field name="date_order" select="1"/>
<field name="date_order"/>
<field name="date_validation"/>
<field name="date_payment"/>
<field name="user_id"/>
<field name="invoice_id"/>
<field name="state" select="1"/>
<field name="state" />
<field name="amount_total" sum="Amount total"/>
<field name="company_id"/>
</tree>

View File

@ -496,8 +496,8 @@
id="stock.next_id_61"
name="Reporting"
parent="stock.menu_stock_root" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_root" sequence="19" groups="res_groups_posuser0"/>
<menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_warehouse_mgmt" sequence="19" groups="res_groups_posuser0"/>
<!-- <menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<menuitem parent="stock.next_id_61" action="stock.action_stock_line_date" id="stock.menu_report_stock_line_date" groups="base.group_user"/>
</data>

View File

@ -0,0 +1,476 @@
-
In order to test the POS in module, To gives business owners a convenient way of checking out customers and of recording sales.
-
I configure all details for the customer,Salesman and Product ,Account.
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create partner
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create partner address.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create partner invoice address.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
type: invoice
-
I create partner delivery address.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
I create product category.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I create partner.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable1
property_account_receivable: account_account_receivable0
supplier: true
-
I create partner address .
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: Ms.
-
I create product category .
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I create product template .
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
procure_method: make_to_order
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create product LG Viewty Smart.
-
!record {model: product.product, id: product_product_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
procure_method: make_to_order
property_account_expense: account_account_payable1
property_account_income: account_account_receivable0
seller_delay: '1'
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create product category .
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product HP Pavilion Desktop PCs
-
!record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
categ_id: product_category_computer0
cost_method: standard
mes_type: fixed
list_price: 1000.0
name: HP Pavilion Desktop PCs
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_microlinktechnologies0
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_payable1
property_account_income: account_account_receivable0
-
I create New Order by adding the details of Salesman and "Product" as LG Viewty Smart Quantity as 10.
-
!record {model: pos.order, id: pos_order_pos0}:
company_id: base.main_company
date_order: '2010-05-13 15:02:48'
date_validity: '2010-11-13'
lines:
- company_id: base.main_company
name: Order Line/01
notice: No Discount
product_id: product_product_lgviewtysmart0
qty: 10.0
qty_rfd: 0.0
partner_id: base.res_partner_agrolait
name: POS/001
price_type: tax_excluded
pricelist_id: product.list0
sale_journal: account.sales_journal
shop_id: sale.shop
user_salesman_id: base.user_root
-
I add discount.
-
!record {model: pos.discount, id: pos_discount_0}:
discount: 5.0
discount_notes: More then 5 product
-
I Apply the discount.
-
!python {model: pos.discount}: |
self.apply_discount(cr, uid, [ref("pos_discount_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id":
ref("pos_order_pos0"), })
-
I open the register.
-
!record {model: pos.open.statement, id: pos_open_statement_0}:
{}
-
I open the statement.
-
!python {model: pos.open.statement}: |
self.open_statement(cr, uid, [ref("pos_open_statement_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "active_ids": [ref("point_of_sale.menu_open_statement")], "tz":
False, "active_id": ref("point_of_sale.menu_open_statement"), })
-
I click on the "Make Payment" wizard.
-
!record {model: pos.make.payment, id: pos_make_payment_0}:
amount: 1615.0
journal: 5
payment_date: 2010-05-13
payment_name: Payment
product_id: product_product_hppaviliondesktoppcs0
-
I make the payment.
-
!python {model: pos.make.payment}: |
self.check(cr, uid, [ref("pos_make_payment_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
False, "active_id": ref("point_of_sale.pos_order_pos0"), })
-
I check the Statement lines are created automatically when payment is done.
-
!python {model: pos.order}: |
order=self.browse(cr,uid,ref("pos_order_pos0"))
assert(order.statement_ids!=[]), "Statement lines not created"
-
When I click on Return picking button , I get three option.
-
1. Cancel 2.Return Goods and Exchange 3.Return without Refund
-
When I click on Return Goods and Exchange.
-
Then it allows me to define the quantity of products, which will return to the stock.
-
I click on Return Picking button.
-
!record {model: pos.return, id: pos_return_0}:
{}
-
I Return the product.
-
!python {model: pos.return}: |
self.create_returns(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
False, "active_id": ref("point_of_sale.pos_order_pos0"), })
-
Then it allows me to define the quantity of products, which will return to the stock.
-
I select the HP Pavilion Desktop PCs for exchange.
-
!record {model: pos.add.product, id: pos_add_product_0}:
product_id: product_product_hppaviliondesktoppcs0
quantity: 5.0
-
I click on close button.
-
!python {model: pos.add.product}: |
self.close_action(cr, uid, [ref("pos_add_product_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
})
-
I create payment.
-
!record {model: pos.make.payment, id: pos_make_payment_1}:
amount: 680.0
journal: 5
payment_date: 2010-05-13
payment_name: Payment
product_id: product_product_hppaviliondesktoppcs0
-
For payment, I click on Make Payment.
-
!python {model: pos.make.payment}: |
self.check(cr, uid, [ref("pos_make_payment_1")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
False, "active_id": ref("pos_order_pos0"), })
-
To check the Return without Refund . I click button "Return without Refund ".
-
!record {model: pos.return, id: pos_return_0}:
{}
-
The quantity which is selected in Return lines wizard is refunded.
-
!python {model: pos.return}: |
self.create_returns2(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
False, "active_id": ref("pos_order_pos0"), })
-
To Close order, I use the wizard "Sale Confirm".
-
!record {model: pos.confirm, id: pos_confirm_0}:
{}
-
I close this order.
-
!python {model: pos.confirm}: |
self.action_confirm(cr, uid, [ref("pos_confirm_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
})

View File

@ -55,7 +55,7 @@ class pos_get_sale(osv.osv_memory):
for pick in proxy_pick.browse(cr, uid, [this.picking_id.id], context):
proxy_pos.write(cr, uid, record_id, {
'last_out_picking': this.picking_id.id,
'picking_id': this.picking_id.id,
'partner_id': pick.address_id and pick.address_id.partner_id.id
})

View File

@ -44,48 +44,50 @@ class pos_make_payment(osv.osv_memory):
"""
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
active_id = context and context.get('active_id',False)
j_obj = self.pool.get('account.journal')
company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
journal = journal[0]
else:
journal = None
wf_service = netsvc.LocalService("workflow")
order_obj=self.pool.get('pos.order')
order = order_obj.browse(cr, uid, active_id, context)
#get amount to pay
amount = order.amount_total - order.amount_paid
if amount <= 0.0:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
elif order.amount_paid > 0.0:
order_obj.write(cr, uid, [active_id], {'state': 'advance'})
invoice_wanted_checked = False
current_date = time.strftime('%Y-%m-%d')
active_id = context and context.get('active_id',False)
if active_id:
j_obj = self.pool.get('account.journal')
company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if 'journal' in fields:
res.update({'journal':journal})
if 'amount' in fields:
res.update({'amount':amount})
if 'invoice_wanted' in fields:
res.update({'invoice_wanted':invoice_wanted_checked})
if 'payment_date' in fields:
res.update({'payment_date':current_date})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
if journal:
journal = journal[0]
else:
journal = None
wf_service = netsvc.LocalService("workflow")
order_obj=self.pool.get('pos.order')
order = order_obj.browse(cr, uid, active_id, context)
#get amount to pay
amount = order.amount_total - order.amount_paid
if amount <= 0.0:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
elif order.amount_paid > 0.0:
order_obj.write(cr, uid, [active_id], {'state': 'advance'})
invoice_wanted_checked = False
current_date = time.strftime('%Y-%m-%d')
if 'journal' in fields:
res.update({'journal':journal})
if 'amount' in fields:
res.update({'amount':amount})
if 'invoice_wanted' in fields:
res.update({'invoice_wanted':invoice_wanted_checked})
if 'payment_date' in fields:
res.update({'payment_date':current_date})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
return res
def view_init(self, cr, uid, fields_list, context=None):
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
active_id = context and context.get('active_id', False) or False
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if not order.lines:
raise osv.except_osv('Error!','No order lines defined for this sale ')
if active_id:
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if not order.lines:
raise osv.except_osv('Error!','No order lines defined for this sale ')
return True
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@ -110,7 +112,7 @@ class pos_make_payment(osv.osv_memory):
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if order.amount_total == order.amount_paid:
res['arch'] = """ <form string="Make Payment" colspan="4">
result['arch'] = """ <form string="Make Payment" colspan="4">
<group col="2" colspan="2">
<label string="Do you want to print the Receipt?" colspan="4"/>
<separator colspan="4"/>

View File

@ -158,19 +158,23 @@ class pos_return(osv.osv_memory):
location_id=res and res[0] or None
stock_dest_id = val.id
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
new_picking=picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
'move_lines':[], 'state':'draft', 'type':'in',
'type':'in',
'date':date_cur})
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
'lines':[],
'statement_ids':[],
'last_out_picking':[]})
'picking_id':[]})
for line in order_id.lines:
if line.id and (data['return%s' %line.id]!=0.0):
if line.id :
try:
qty= data['return%s' %line.id]
except :
qty= line.qty
new_move=stock_move_obj.create(cr, uid,{
'product_qty': data['return%s' %line.id],
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['return%s' %line.id] ,line.product_id.uom_id.id),
'product_qty': qty ,
'product_uos_qty': uom_obj._compute_qty(cr, uid,qty ,line.product_id.uom_id.id),
'picking_id':new_picking,
'product_uom':line.product_id.uom_id.id,
'location_id':location_id,
@ -179,7 +183,7 @@ class pos_return(osv.osv_memory):
'name':'%s (return)' %order_id.name,
'date':date_cur,
'date_planned':date_cur,})
line_obj.copy(cr,uid,line.id,{'qty':-data['return%s' %line.id],
line_obj.copy(cr,uid,line.id,{'qty':-qty ,
'order_id': new_order,
})
order_obj.write(cr,uid, new_order, {'state':'done'})
@ -262,7 +266,7 @@ class add_product(osv.osv_memory):
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
order_obj.write(cr,uid,active_id,{'last_out_picking':new_picking})
order_obj.write(cr,uid,active_id,{'picking_id':new_picking})
return {

View File

@ -22,11 +22,12 @@
<field name="name">PCE</field>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
<field name="rounding">1.0</field>
</record>
<record id="product_uom_kgm" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">KGM</field>
<field name="factor">1.0</field>
<field name="factor">1000.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_hour" model="product.uom">

View File

@ -14,12 +14,12 @@
<filter string="Can be sold" icon="terp-stock" domain="[('sale_ok','=',1)]"/>
<filter string="Can be Purchased" icon="terp-stock" domain="[('purchase_ok', '=', 1)]" />
<separator orientation="vertical"/>
<field name="default_code" select="1"/>
<field name="name" select="1"/>
<field name="categ_id" select="1" widget="selection" operator="child_of"/>
<field name="default_code"/>
<field name="name"/>
<field name="categ_id" widget="selection" operator="child_of"/>
<newline/>
<group col='8' colspan='14' expand="1" string="Extended options...">
<field name="pricelist_id" select="1" widget="selection" context="{'pricelist': self}" />
<field name="pricelist_id" widget="selection" context="{'pricelist': self}" />
</group>
<newline/>
<group col='8' colspan='15' expand='1' string='Group by...'>
@ -64,13 +64,12 @@
<form string="Product">
<group colspan="4" col="6">
<group colspan="4" col="2">
<separator string="Product Description" colspan="4"/>
<field name="name" select="1" />
<field name="name"/>
<field groups="product.group_product_variant" name="variants" />
</group>
<group colspan="1" col="2">
<separator string="Codes" colspan="2"/>
<field name="default_code" select="1"/>
<field name="default_code"/>
<field name="ean13" groups="base.group_extended"/>
</group>
<group colspan="1" col="2">
@ -99,7 +98,7 @@
<group colspan="2" col="2" name="status">
<separator string="Status" colspan="2"/>
<field name="categ_id" select="1"/>
<field name="categ_id"/>
<field name="state"/>
<field groups="base.group_extended" name="product_manager"/>
</group>
@ -162,10 +161,10 @@
<page groups="base.group_extended" string="Packaging">
<field colspan="4" name="packaging" nolabel="1">
<form string="Packaging">
<field name="ean" select="1"/>
<field name="ean"/>
<field name="sequence" invisible="1"/>
<newline/>
<field name="qty" select="1"/>
<field name="qty"/>
<field name="ul"/>
<field name="weight_ul"/>
<separator colspan="4" string="Palletization"/>
@ -177,7 +176,7 @@
<field name="width"/>
<field name="length"/>
<separator colspan="4" string="Other Info"/>
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="name"/>
</form>
</field>
</page>

View File

@ -424,10 +424,10 @@
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="20">
<filter string="Users" name="user_id" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}" default = "1"/>
<filter string="Stage" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-project" domain="[]" context="{'group_by':'state'}"/>
<filter string="Users" name="group_user_id" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Project" name="group_project_id" icon="terp-project" domain="[]" context="{'group_by':'project_id'}" default = "1"/>
<filter string="Stage" name="group_stage_id" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
<filter string="State" name="group_state" icon="terp-project" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Deadline" icon="terp-project" domain="[]" context="{'group_by':'date_deadline'}"/>
<filter string="Start Date" icon="terp-project" domain="[]" context="{'group_by':'date_start'}"/>

View File

@ -49,7 +49,9 @@ automatically created via sale orders.
'website': 'http://www.openerp.com',
'depends': ['project', 'mrp_procurement', 'sale', 'mrp_jit'],
'init_xml': [],
'update_xml': ['project_mrp_workflow.xml', 'process/project_mrp_process.xml'],
'update_xml': ['project_mrp_workflow.xml',
#'process/project_mrp_process.xml',
],
'demo_xml': [],
'installable': True,
'active': False,

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow.transition" id="mrp.trans_produce_service_make_done">
<field name="act_from" ref="mrp.act_produce_service"/>
<record model="workflow.transition" id="mrp_procurement.trans_produce_service_make_done">
<field name="act_from" ref="mrp_procurement.act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<field name="signal">subflow.done</field>
</record>

View File

@ -51,6 +51,11 @@
'process/purchase_process.xml',
'report/purchase_report_view.xml',
],
'test': [
'test/purchase_from_order.yml',
'test/purchase_from_manual.yml',
# 'test/purchase_from_picking.yml',
],
'demo_xml': ['purchase_demo.xml','purchase_unit_test.xml'],
'installable': True,
'active': False,

View File

@ -699,7 +699,7 @@ purchase_order_line()
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Purchase Order'),
'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'),
}
def action_po_assign(self, cr, uid, ids, context={}):

View File

@ -5,7 +5,7 @@
groups="group_purchase_user"/>-->
<menuitem icon="terp-purchase" id="base.menu_purchase_root" name="Procurement Management"
groups="group_purchase_user" sequence="7"/>
<menuitem id="menu_procurement_management" name="Procurement Management"
<menuitem id="menu_procurement_management" name="Purchase Management"
parent="base.menu_purchase_root" sequence="1"/>
<!--supplier menu-->
@ -68,7 +68,7 @@
<field name="arch" type="xml">
<form string="Purchase Order">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="name"/>
<field name="date_order"/>
<field name="invoiced"/>
<newline/>
@ -79,7 +79,7 @@
</group>
<notebook colspan="4">
<page string="Purchase Order">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" domain="[('supplier','=', 1)]"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('supplier','=', 1)]"/>
<field name="partner_address_id"/>
<field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_extended"/>
<field name="partner_ref"/>

View File

@ -0,0 +1,148 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
-
Creating an purchase.order record
-
!record {model: purchase.order, id: purchase_order_po1}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: order
location_id: stock.stock_location_stock
name: PO00010
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po1")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po1"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po1")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po1}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created

View File

@ -0,0 +1,154 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Order
-
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po0}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: order
location_id: stock.stock_location_stock
name: PO00003
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po0")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets called
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po0"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po0")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po0}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value
-
!python {model: purchase.order}: |
pur_id2=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id2.invoice_id)

View File

@ -0,0 +1,174 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
-
Creating an purchase.order record
-
!record {model: purchase.order, id: purchase_order_po2}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: picking
location_id: stock.stock_location_stock
name: PO00008
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po2")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po2")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po2}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created
-
Then I create an invoice from picking by clicking on "Create Invoice" wizard
-
Creating a stock.invoice.onshipping record
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
invoice_date: '2010-05-11'
journal_id: account.bank_journal
type: in_invoice
-
Performing an osv_memory action create_invoice on module stock.invoice.onshipping
-
!python {model: stock.invoice.onshipping}: |
pur_obj=self.pool.get('purchase.order')
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "search_default_approved": 1, "active_model": "stock.picking",
"active_ids": ids, "active_id": ids[0], })
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value
-
!python {model: purchase.order}: |
pur_id2=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id2.invoice_id)

View File

@ -25,7 +25,7 @@ class purchase_installer(osv.osv_memory):
_inherit = 'res.config.installer'
_columns = {
'purchase_requisition':fields.boolean('Purchase Requisition'),
'purchase_requisition':fields.boolean('Purchase Requisition',help="Manages your Purchase Requisition and allow you to easily keep track and manage all your purchase orders."),
}
purchase_installer()

View File

@ -5,7 +5,7 @@
<!-- Make the invoice-->
<record id="view_purchase_line_invoice" model="ir.ui.view">
<field name="name">Control invoices</field>
<field name="name">Create invoices</field>
<field name="model">purchase.order.line_invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
@ -21,7 +21,7 @@
</field>
</record>
<act_window name="Control invoices"
<act_window name="Create invoices"
res_model="purchase.order.line_invoice"
src_model="purchase.order.line"
view_mode="form"

View File

@ -34,8 +34,10 @@
"update_xml" : ["wizard/purchase_requisition_partner_view.xml",
"purchase_requisition_view.xml",
"security/ir.model.access.csv","purchase_requisition_sequence.xml"],
"active": False,
"test":[
# 'test/purchase_requisition.yml','test/purchase_requisition_exclusive.yml'
],
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -78,7 +78,7 @@ class purchase_requisition_line(osv.osv):
_description="Purchase Requisition Line"
_rec_name = 'product_id'
_columns = {
'product_id': fields.many2one('product.product', 'Product' , domain=[('purchase_requisition', '=', True)]),
'product_id': fields.many2one('product.product', 'Product' ),
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
'product_qty': fields.float('Quantity', digits=(16,2)),
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
@ -86,28 +86,24 @@ class purchase_requisition_line(osv.osv):
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade')
}
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
""" Changes UoM and name if product_id changes.
@param name: Name of the field
@param product_id: Changed product_id
@return: Dictionary of changed values
"""
value = {}
value = {'product_uom_id': ''}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
value = {'product_uom_id': prod.uom_id.id}
return {'value': value}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
purchase_requisition_line()
class purchase_order(osv.osv):
_inherit = "purchase.order"
_description = "purchase order"

View File

@ -33,53 +33,63 @@
<field name="arch" type="xml">
<form string="Purchase Requisition">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="user_id" select="1"/>
<field name="exclusive" select="1"/>
<field name="name"/>
<field name="user_id"/>
<field name="exclusive"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="origin"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="Products">
<field name="line_ids" colspan="4" nolabel="1">
<tree string="Products" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id)"/>
<field name="product_id" on_change="onchange_product_id(product_id,product_uom_id)"/>
<field name="product_qty"/>
<field name="product_uom_id"/>
</tree>
<form string="Products" editable="bottom">
<field name="product_id"/>
<field name="product_id" />
<field name="product_qty"/>
<field name="product_uom_id"/>
<field name="product_uom_id" />
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</form>
</field>
</page>
<page string="Notes">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Quotations">
<group col="8" colspan="4">
<button name="%(action_purchase_requisition_partner)d" string="New RfQr" type="action" />
<label colspan="6" string=""/>
</group>
<field name="purchase_ids" nolabel="1" colspan="4"/>
</page>
</notebook>
<separator colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1" readonly ="1"/>
<button name="tender_in_progress" states="draft" string="Confirm" type="object" icon="gtk-apply" />
<button name="tender_reset" states="done,cancel" string="Reset to Draft" type="object" icon="gtk-convert" />
<button name="tender_done" states="in_progress" string="Done" type="object" icon="gtk-jump-to" />
<button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" icon="gtk-cancel" />
</group>
</group>
</page>
<page string="Quotations">
<field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form">
<tree string="Purchase Order">
<field name="name" string="Reference"/>
<field name="date_order" string="Order Date"/>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="location_id"/>
<field name="minimum_planned_date"/>
<field name="origin"/>
<field name="state"/>
</tree>
</field>
<separator colspan="4" string=""/>
<group col="8" colspan="4">
<label colspan="6" string=""/>
<button name="%(action_purchase_requisition_partner)d" string="Requests for Quotation" type="action" icon="gtk-execute" />
</group>
</page>
<page string="Notes">
<field name="description" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
@ -91,6 +101,7 @@
<tree string="Purchase Requisition">
<field name="name"/>
<field name="user_id"/>
<field name="purchase_ids"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="origin"/>
@ -106,7 +117,8 @@
<field name="arch" type="xml">
<search string="Search Purchase Requisition">
<group col='10' colspan='4'>
<filter icon="terp-purchase" string=" Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
<filter icon="terp-purchase" string="Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
<filter icon="terp-purchase" string="Done" domain="[('state','=','done')]" separator="1" help="Current Purchaes Requisition"/>
<separator orientation="vertical"/>
<field name="name" select="1" string="Requisition Reference"/>
<field name="purchase_ids" select="1"/>
@ -119,8 +131,11 @@
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Date Start" icon="terp-purchase" domain="[]" context="{'group_by':'date_start'}"/>
<filter string="Date End" icon="terp-purchase" domain="[]" context="{'group_by':'date_end'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-purchase" domain="[]" context="{'group_by':'origin'}"/>
</group>
</search>
</field>

View File

@ -0,0 +1,183 @@
-
In order to test the purchase requisition module, I will do a sale order -> purchase_requisition ->
purchase flow and I will buy the required products at two different suppliers.
-
I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO,
with the generation of purchase requisitions.
-
!record {model: product.product, id: product_product_laptopacer0}:
categ_id: product.product_category_3
cost_method: standard
mes_type: fixed
name: Laptop ACER
procure_method: make_to_order
purchase_requisition: 1
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
list_price: 100.0
-
Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001.
-
!record {model: sale.order, id: sale_order_testtender0}:
date_order: '2010-05-10'
invoice_quantity: order
name: TEST/TENDER/0001
order_line:
- name: Laptop ACER
price_unit: 100.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
delay: 7.0
product_id: product_product_laptopacer0
product_uos_qty: 5.0
th_weight: 0.0
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender0}
-
I launch he scheduler to compute all procurements, and specify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
proc_obj._procure_confirm(cr,uid)
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC .
-
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}:
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
-
I create a new purchase order.
-
!python {model: purchase.requisition.partner}: |
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang":
'en_US', "active_model": "purchase.requisition", "tz": False, "record_id":
1, "active_ids": ids, "active_id": ids[0], })
-
I check that I have two purchase orders on the purchase tender.
-
!python {model: purchase.order}: |
order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
ids=len(order_ids)
assert (ids==2), "Purchase order hasn't Created"
-
I set the purchase requisition as 'Not Exclusive'.
-
!python {model: purchase.requisition}: |
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
self.write(cr,uid,ids[0],{'exclusive': 'multiple' })
-
I change the quantities so that the purchase order for DistriPC includes 3 pieces and the
purchase order for Asustek includes 2 pieces.
-
!python {model: purchase.order}: |
line_obj=self.pool.get('purchase.order.line')
partner_obj=self.pool.get('res.partner')
requistion_obj=self.pool.get('purchase.requisition')
requistion_ids =requistion_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0]
partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0]
purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)])
purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)])
order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id
order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id
line_obj.write(cr, uid, order_line1, {'product_qty':2})
line_obj.write(cr, uid, order_line2, {'product_qty':3})
-
I confirm and validate both purchase orders.
-
!python {model: purchase.order}: |
order_ids= self.search(cr, uid, [])
import netsvc
wf_service = netsvc.LocalService("workflow")
for id in order_ids:
wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr)
wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr)
-
I check that the delivery order of the customer is in state 'Waiting Goods'.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','delivery')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert (pick.state) =='confirmed'," Order is not confirm"
assert(pick.move_lines[0].state=='wating'),'Order is not wating"'
-
I receive the order of the supplier Asustek from the Incoming Products menu.
-
!python {model: stock.picking }: |
import time
partner_obj=self.pool.get('res.partner')
order_obj=self.pool.get('purchase.order')
partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0]
picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id': 2,
'address_id': 6,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I receive the order of the supplier DistriPC from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0]
picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I check that the delivery order of the customer is in the state Available.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert (pick.state) =='available'," Order is not available"

View File

@ -0,0 +1,112 @@
-
In order to test the purchase requisition module, I will do a sale order -> purchase_requisition ->
purchase flow and I will buy the required products at two different suppliers.
-
I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO,
with the generation of purchase requisitions.
-
!record {model: product.product, id: product_product_laptopacer1}:
categ_id: product.product_category_3
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: Laptop ACER1
procure_method: make_to_order
purchase_requisition: 1
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0002
-
!record {model: sale.order, id: sale_order_testtender1}:
date_order: '2010-04-20'
invoice_quantity: order
name: TEST/TENDER/0002
order_line:
- name: Laptop ACER1
price_unit: 1000.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
'delay': 7.0
'product_id': product_product_laptopacer1
'type': make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender1}
-
I launch he scheduler to compute all procurements, and planify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
proc_obj._procure_confirm(cr,uid)
-
I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for
5 Laptop ACER, and a purchase order on the default supplier for this product.
-
!python {model: purchase.requisition}: |
requisition_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
ids=len(requisition_ids)
assert len(requisition_ids), "Purchase requisition hasn't Created"
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
the button 'New Request for Quotation'. This opens a window to ask me the supplier and I set DistriPC .
-
I Create purchase.requisition.partner .
-
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}:
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
-
I create a new purchase order for the supplier 'DistriPC'.
-
!python {model: purchase.requisition.partner}: |
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang":
'en_US', "active_model": "purchase.requisition", "tz": False, "record_id":
1, "active_ids": ids, "active_id": ids[0], })
-
I set the purchase tender as 'Exclusive'
-
!python {model: purchase.requisition}: |
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
self.write(cr,uid,ids[0],{'exclusive': 'exclusive' })
-
I confirm and validate the Request for Quotation of ASUStek.
-
!python {model: purchase.order}: |
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0]
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0]
import netsvc
wf_service = netsvc.LocalService("workflow")
if purchase_id:
wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_confirm', cr)
wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr)
-
I check that Request for Quotation of DistriPC is cancelled.
-
!python {model: purchase.order}: |
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0]
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0]
state=self.browse(cr,uid,purchase_id).state
assert (state=='cancel')

View File

@ -111,11 +111,11 @@ class purchase_requisition_partner(osv.osv_memory):
})
list_line.append(purchase_order_line)
purchase_id = order_obj.create(cr, uid, {
'origin': tender.name,
'origin': tender.purchase_ids and tender.purchase_ids[0].origin or tender.name,
'partner_id': partner_id,
'partner_address_id': address_id,
'pricelist_id': pricelist_id,
'location_id': line.product_id.product_tmpl_id.property_stock_production.id,
'location_id': tender.purchase_ids and tender.purchase_ids[0].location_id.id or line.product_id.product_tmpl_id.property_stock_production.id,
'company_id': tender.company_id.id,
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False,
'requisition_id':tender.id,

View File

@ -9,6 +9,7 @@
<form string="Purchase Requisition">
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_address_id"/>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
<button icon="gtk-ok" name="create_order" string="Create Orders" type="object"/>

View File

@ -47,6 +47,7 @@
'update_xml': [
'wizard/sale_make_invoice_advance.xml',
'wizard/sale_line_invoice.xml',
'wizard/sale_make_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
'company_view.xml',
@ -60,6 +61,12 @@
# 'process/sale_process.xml',
],
'demo_xml': ['sale_demo.xml'],
'test': [
'test/shipping_manual_sale_order.yml',
'test/prepaid_sale_order.yml',
'test/advance_invoice.yml',
'test/sale_procurement.yml',
],
'installable': True,
'active': False,
'certificate': '0058103601429',

View File

@ -97,16 +97,16 @@
<field name="arch" type="xml">
<form string="Sales order">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="name"/>
<field name="client_order_ref"/>
<field name="shipped"/>
<field name="date_order" select="1"/>
<field name="date_order"/>
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="base.group_extended"/>
<field name="invoiced"/>
</group>
<notebook colspan="4">
<page string="Sale Order">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1" select="1"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id"/>
@ -123,12 +123,12 @@
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
name="product_id"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order, product_packaging, parent.fiscal_position)"
select="1"/>
/>
<field
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
name="product_uom_qty"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
select="1"/>
/>
<field name="product_uom"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
<field name="product_uos_qty" on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
@ -366,11 +366,11 @@
<notebook>
<page string="Order Lines">
<separator colspan="4" string="General Information"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" readonly="1" select="1" invisible="1"/>
<field name="order_id"/>
<field name="order_partner_id" readonly="1" invisible="1"/>
<field name="product_uom_qty" readonly="1"/>
<field name="product_uom"/>
<field name="product_id" readonly="1" select="1"/>
<field name="product_id" readonly="1"/>
<field name="invoiced"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<separator colspan="4" string="Manual Designation"/>
@ -417,16 +417,16 @@
<search string="Search Sales Order">
<filter icon="terp-purchase" string="To Invoice" domain="[('invoiced','&lt;&gt;', 1),('state','=','done')]" separator="1"/>
<separator orientation="vertical"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" select="1"/>
<field name="product_id" select="1"/>
<field name="salesman_id" select="1" widget="selection">
<field name="order_id"/>
<field name="order_partner_id"/>
<field name="product_id"/>
<field name="salesman_id" widget="selection">
<filter icon="terp-sale" domain="[('salesman_id','=',uid)]" help="My Sale Order Lines"/>
<filter icon="terp-sale" domain="[('salesman_id','child_of',[uid])]" help="My Departments Sale Order Lines"/>
</field>
<newline/>
<group expand="context.get('report',False)" string="Group By..." colspan="9" col="8">
<filter string="Product" icon="terp-sale" default="1" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Product" icon="terp-sale" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Order" icon="terp-sale" domain="[]" context="{'group_by':'order_id'}"/>
<filter string="Salesman" icon="terp-sale" domain="[]" context="{'group_by':'salesman_id'}"/>
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
@ -445,14 +445,14 @@
domain="[('state','=','done')]"
name="unshipped"
separator="1" />
<filter icon="terp-purchase" string="Uninvoiced"
domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]" default="1"
<filter icon="terp-purchase" string="Uninvoiced" name="uninvoiced"
domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]"
separator="1" />
<separator orientation="vertical"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" select="1"/>
<field name="product_id" select="1"/>
<field name="state" select="1"/>
<field name="order_id"/>
<field name="order_partner_id"/>
<field name="product_id"/>
<field name="state"/>
<newline />
<group expand="1" string="Group By..." colspan="9" col="8">
<filter string="Product" icon="terp-sale" domain="[]" context="{'group_by':'product_id'}"/>

View File

@ -0,0 +1,301 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
procure_method: make_to_order
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
-
!record {model: product.product, id: product_product_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-03'
invoice_quantity: order
name: SO004
order_line:
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 500.0
th_weight: 0.0
type: make_to_order
order_policy: prepaid
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I use the Advance Payment wizard.
-
!record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
amount: 1000.0
product_id: product.product_product_pc3
qtty: 3.0
-
Performing an osv_memory action create_invoices on module sale.advance.payment.inv
-
!python {model: sale.advance.payment.inv}: |
self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
"active_model": 'sale.order', "active_ids": [ref("sale_order_so0")], "tz":
False, "active_id": ref("sale_order_so0"), })
-
I will verify whether the invoice has been generated.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"

View File

@ -0,0 +1,379 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
procure_method: make_to_order
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
-
!record {model: product.product, id: product_product_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
-
!record {model: sale.order, id: sale_order_so1}:
date_order: '2010-05-03'
invoice_quantity: order
name: Test_SO001
order_line:
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 500.0
th_weight: 0.0
type: make_to_order
order_policy: prepaid
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so1}
-
I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so1"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 85000.0
date: '2010-05-10'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
-
I will verify the picking associated with the sale order sale_order_so1
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.picking_ids,"Picking has not been generated for sale_order_so1"
-
Products are delivered to the Cleartrail Customer.
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."

View File

@ -0,0 +1,91 @@
-
In order to test the sale order working with procurements I will create some
products with different supply method and procurement method.
-
I create two products.
-
!record {model: product.product, id: product_product_table0}:
categ_id: product.cat1
name: Table
procure_method: make_to_order
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
!record {model: product.product, id: product_product_wood0}:
categ_id: product.cat1
name: Wood
procure_method: make_to_stock
supply_method: buy
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I define Minimum stock rule for my stockable product wood
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
product_id: product_product_wood0
product_max_qty: 15.0
product_min_qty: 10.0
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
-
Now I make a sale order for table.
-
!record {model: sale.order, id: sale_order_so3}:
amount_total: 5.0
amount_untaxed: 5.0
date_order: '2010-04-30'
invoice_quantity: order
order_line:
- company_id: base.main_company
delay: 7.0
name: Table
price_unit: 1.0
product_id: product_product_table0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
product_uos_qty: 5.0
state: draft
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
-
I check that one procurement is generated.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('state','=','confirmed')]"
-
I check that the procurement for the product table is in exception state.
As my product's supply method is produce and mrp module is yet not installed.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','exception')])
assert proc_ids, _('No Procurements are in exception state!')

View File

@ -0,0 +1,384 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
procure_method: make_to_order
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
-
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-12'
invoice_quantity: order
name: Test_SO002
order_line:
- name: New Chocolate Slider Mobile
price_unit: 200.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_newchocolateslidermobile0
product_uos_qty: 500.0
type: make_to_order
order_policy: manual
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I click on Create Invoice button to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 100000.0
date: '2010-05-10'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I verify the picking associated with the sale order sale_order_so0.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
-
Products are delivered to the Cleartrail Customer.
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."

View File

@ -19,8 +19,9 @@
#
##############################################################################
#remaining make_invoice
import sale_make_invoice
import sale_line_invoice
import sale_make_invoice_advance
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,96 +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 wizard
import netsvc
import pooler
invoice_form = """<?xml version="1.0"?>
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="grouped" />
<field name="invoice_date" />
</form>
"""
invoice_fields = {
'grouped' : {'string':'Group the invoices', 'type':'boolean', 'default': lambda x,y,z: False},
'invoice_date': {'string': 'Invoiced date', 'type':'date' }
}
ack_form = """<?xml version="1.0"?>
<form string="Create invoices">
<separator string="Invoices created" />
</form>"""
ack_fields = {}
def _makeInvoices(self, cr, uid, data, context):
pool_obj = pooler.get_pool(cr.dbname)
mod_obj = pool_obj.get('ir.model.data')
order_obj = pool_obj.get('sale.order')
newinv = []
order_obj.action_invoice_create(cr, uid, data['ids'], data['form']['grouped'], date_inv = data['form']['invoice_date'])
for id in data['ids']:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
for o in order_obj.browse(cr, uid, data['ids'], context):
for i in o.invoice_ids:
newinv.append(i.id)
act_obj = pool_obj.get('ir.actions.act_window')
xml_id='action_invoice_tree5'
result = mod_obj._get_id(cr, uid, 'account', xml_id)
id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
result = act_obj.read(cr, uid, id)
result['domain'] ="[('id','in', ["+','.join(map(str,newinv))+"])]"
return result
#return {
# 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
# 'name': 'Invoices',
# 'view_type': 'form',
# 'view_mode': 'tree,form',
# 'res_model': 'account.invoice',
# 'view_id': False,
# 'context': "{'type':'out_refund'}",
# 'type': 'ir.actions.act_window'
#}
#return {}
class make_invoice(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form',
'arch' : invoice_form,
'fields' : invoice_fields,
'state' : [('end', 'Cancel'),('invoice', 'Create invoices') ]}
},
'invoice' : {
'actions' : [_makeInvoices],
'result' : {'type': 'state', 'state': 'end'}
},
}
make_invoice("sale.order.make_invoice")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -25,13 +25,6 @@ from tools.translate import _
class sale_order_line_make_invoice(osv.osv_memory):
_name = "sale.order.line.make.invoice"
_description = "Sale OrderLine Make_invoice"
_columns = {
'grouped': fields.boolean('Group the invoices'),
}
_default = {
'grouped' : lambda *a: False
}
def make_invoices(self, cr, uid, ids, context):
"""
To make invoices.

View File

@ -8,8 +8,6 @@
<field name="arch" type="xml">
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="grouped" />
<separator string="" colspan="6" />
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="make_invoices" string="Create Invoices" type="object" icon="gtk-ok"/>
</form>

View File

@ -0,0 +1,74 @@
##############################################################################
#
# 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.translate import _
import ir
import netsvc
class sale_make_invoice(osv.osv_memory):
_name = "sale.make.invoice"
_description = "Sale Make Invoice"
_columns = {
'grouped': fields.boolean('Group the invoices'),
'invoice_date':fields.date('Invoice Date'),
}
_default = {
'grouped' : lambda *a: False
}
def view_init(self, cr, uid, fields_list, context=None):
record_id = context and context.get('active_id', False)
order = self.pool.get('sale.order').browse(cr, uid, record_id)
if order.state=='draft':
raise osv.except_osv(_('Warning !'),'You can not create invoice when sale order is not confirmed.')
return False
def make_invoices(self, cr, uid, ids, context={}):
order_obj = self.pool.get('sale.order')
newinv = []
data=self.read(cr,uid,ids)[0]
order_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data['grouped'],date_inv = data['invoice_date'])
wf_service = netsvc.LocalService("workflow")
for id in context.get(('active_ids'),[]):
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
for o in order_obj.browse(cr, uid, context.get(('active_ids'),[]), context):
for i in o.invoice_ids:
newinv.append(i.id)
mod_obj =self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
return {
'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
'name': 'Invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'out_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['id']
}
sale_make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_sale_order_make_invoice" model="ir.ui.view">
<field name="name">Create invoices</field>
<field name="model">sale.make.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="grouped" />
<field name="invoice_date"/>
<separator string="" colspan="6" />
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="make_invoices" string="Create Invoices" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<act_window name="Make Invoices"
res_model="sale.make.invoice"
src_model="sale.order"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_sale_order_make_invoice"/>
</data>
</openerp>

View File

@ -23,7 +23,6 @@ from service import web_services
from tools.translate import _
import ir
class sale_advance_payment_inv(osv.osv_memory):
_name = "sale.advance.payment.inv"
_description = "Sale Advance Payment Invoice"

View File

@ -22,7 +22,7 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="section_id" widget="selection" groups="base.group_extended"/>
<field name="section_id" widget="selection" groups="base.group_extended"/>
</field>
</field>
</record>
@ -34,7 +34,7 @@
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<field name="date_order" position="after">
<field name="section_id" default="context.get('section_id', False)" select="1" widget="selection" string="Section" groups="base.group_extended">
<field name="section_id" default="context.get('section_id', False)" widget="selection" string="Sale Team" groups="base.group_extended">
<filter icon="terp-crm"
domain="[('section_id','=',context.get('section_id',False))]"
groups="base.group_extended"

View File

@ -10,12 +10,12 @@
<notebook>
<page string="Journal">
<separator string="Journal Information" colspan="4"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_validation" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="date_created"/>
<field name="date_validation"/>
<separator string="States" colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
@ -41,10 +41,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking Journal">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
@ -60,10 +60,10 @@
<filter icon="terp-hr" string="My Picking Journals" domain="[('user_id','=',uid)]" help="My Picking Journals"/>
<filter icon="terp-hr" string="Open" domain="[('state','=','open')]" help="Open Picking Journals"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1" widget="selection"/>
<field name="date" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id" widget="selection"/>
<field name="date"/>
</group>
</search>
</field>

View File

@ -11,11 +11,11 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking by invoice method">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="invoice_state" select="1"/>
<field name="state" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="name"/>
<field name="month"/>
<field name="invoice_state"/>
<field name="state"/>
<field name="invoice_type_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
@ -51,10 +51,10 @@
<filter icon="terp-sale" string="This Year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice method in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by invoice method in this month"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="invoice_state" select="1"/>
<field name="state" select="1"/>
<field name="name"/>
<field name="month"/>
<field name="invoice_state"/>
<field name="state"/>
</group>
</search>
</field>
@ -91,10 +91,10 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking by journals">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="state" select="1"/>
<field name="journal_id" select="1"/>
<field name="name"/>
<field name="month"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
@ -128,9 +128,9 @@
<filter icon="terp-sale" string="This Year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by journals in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by journals in this month"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="state" select="1"/>
<field name="name"/>
<field name="month"/>
<field name="state"/>
</group>
</search>
</field>

View File

@ -42,12 +42,12 @@
<notebook>
<page string="Journal">
<separator string="Journal Information" colspan="4"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_validation" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="date_created"/>
<field name="date_validation"/>
<separator string="States" colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
@ -83,10 +83,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sale Journal">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
@ -102,10 +102,10 @@
<filter icon="terp-sale" string="My Sale Journals" domain="[('user_id','=',uid)]" help="My Sale Journals"/>
<filter icon="terp-sale" string="Open" domain="[('state','=','open')]" help="Open Sale Journals"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date" />
</group>
</search>
</field>
@ -285,9 +285,9 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales by Journal">
<field name="name" select="1"/>
<field name="state" select="1"/>
<field name="journal_id" select="1"/>
<field name="name"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
@ -306,9 +306,9 @@
<filter icon="terp-sale" string="This Year" domain="[('name','!=','')]" help="Sale journal in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('name','=',time.strftime('%%Y-%%m-01'))]" help="Sale journal in this month"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="state" select="1"/>
<field name="journal_id" select="1"/>
<field name="name"/>
<field name="state"/>
<field name="journal_id"/>
</group>
</search>
</field>

View File

@ -68,7 +68,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"security/stock_security.xml",
"security/ir.model.access.csv",
],
'demo_xml': ['stock_demo.xml'],
'test': ['test/stock_test.yml'],
'installable': True,
'active': False,
'certificate': '0055421559965',

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-03-25 14:13+0000\n"
"Last-Translator: Numérigraphe <Unknown>\n"
"PO-Revision-Date: 2010-05-20 06:22+0000\n"
"Last-Translator: Olivier (Open ERP) <Unknown>\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-04-17 03:56+0000\n"
"X-Launchpad-Export-Date: 2010-05-21 03:37+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: stock
@ -677,7 +677,7 @@ msgstr "Date d'envoi prévue"
#. module: stock
#: rml:stock.picking.list:0
msgid "Shipping Address :"
msgstr ""
msgstr "Adresse de livraison"
#. module: stock
#: view:stock.tracking:0
@ -1703,7 +1703,7 @@ msgstr "Magasin"
#: selection:stock.move,state:0
#: selection:stock.picking,state:0
msgid "Done"
msgstr "Terminer"
msgstr "Terminé"
#. module: stock
#: model:stock.location,name:stock.stock_location_locations_virtual

View File

@ -8,8 +8,8 @@
<field name="type">search</field>
<field name="inherit_id" ref="product.product_search_form_view"/>
<field name="arch" type="xml">
<field name="pricelist_id" select="1" widget="selection" position="before">
<field name="location_id" select="1" widget="selection" context="{'location': self}" />
<field name="pricelist_id" widget="selection" position="before">
<field name="location_id" widget="selection" context="{'location': self}" />
<separator orientation="vertical"/>
</field>
</field>

View File

@ -28,35 +28,48 @@ class report_stock_move(osv.osv):
_description = "Stock Statistics"
_auto = False
_columns = {
'date': fields.date('Date', readonly=True),
'date_planned': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'location_id':fields.many2one('stock.location', 'Location', readonly=True),
'location_id': fields.many2one('stock.location', 'Source Location', readonly=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', readonly=True, select=True, help="Location where the system will stock the finished products."),
'product_qty':fields.integer('Qty',readonly=True),
'value' : fields.float('Total Value', required=True),
'product_uom': fields.many2one('product.uom', 'Product UOM', readonly=True),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
'day_diff':fields.integer('Expected Performance',readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_move')
cr.execute("""
create or replace view report_stock_move as (
select min(m.id) as id,
m.date as date,
to_char(date_trunc('day',m.date), 'YYYY') as year,
to_char(date_trunc('day',m.date), 'MM') as month,
to_char(date_trunc('day',m.date), 'YYYY-MM-DD') as day,
m.location_id as location_id,
m.product_id as product_id,
m.state as state,
sum(m.product_qty) as product_qty
from stock_move as m group by m.product_id, m.location_id, m.id, m.date, m.state
)
select min(m.id) as id,
m.date_planned as date_planned,
to_char(date_trunc('day',m.date_planned), 'YYYY') as year,
to_char(date_trunc('day',m.date_planned), 'MM') as month,
to_char(date_trunc('day',m.date_planned), 'YYYY-MM-DD') as day,
(date(m.date_planned)-date(m.date_expected)) as day_diff,
m.address_id as partner_id,
m.location_id as location_id,
m.location_dest_id as location_dest_id,
m.product_id as product_id,
m.state as state,
m.product_uom as product_uom,
sum(m.product_qty) as product_qty,
pt.standard_price * sum(m.product_qty) as value
from stock_move m ,product_product pp,product_template pt
where
m.product_id=pp.id and pp.product_tmpl_id=pt.id
group by
m.id, m.product_id,m.address_id, m.location_id, m.location_dest_id,
m.date_planned, m.state, m.product_uom,pt.standard_price,m.date_expected )
""")
report_stock_move()

View File

@ -7,14 +7,20 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Stock Orders Statistics">
<field name="date"/>
<field name="date_planned"/>
<field name="day_diff"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="location_id" invisible="1"/>
<field name="location_dest_id" invisible="1"/>
<field name="product_id"/>
<field name="partner_id"/>
<field name="product_qty"/>
<field name="location_id"/>
<field name="product_uom"/>
<field name="state"/>
<field name="value"/>
</tree>
</field>
</record>
@ -43,13 +49,14 @@
domain="[('year','=',time.strftime('%%Y'))]"
help="Stock Moves of the year"/>
<filter icon="terp-stock"
name="month"
string="This Month"
domain="[('month','=',time.strftime('%%m'))]"
help="Stock Moves of this month"/>
<filter icon="terp-stock"
string="Current Stock"
string="Today"
separator="1"
domain="[('date', '=', time.strftime('%%Y-%%m-%%d')]"
domain="[('date_planned','&gt;=', time.strftime('%%Y-%%m-%%d')), ('date_planned','&lt;',(datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d'))]"
help="Stock Moves of today"/>
<separator orientation="vertical"/>
@ -64,22 +71,35 @@
help = "Available Stock-Moves"/>
<filter string="Done"
name="done"
icon="terp-stock"
domain="[('state','=','done')]"
help = "Completed Stock-Moves"/>
<separator orientation="vertical"/>
<filter icon="terp-stock" string="Internal Locations" domain="[('location_id.usage','=','internal')]"/>
<filter icon="terp-stock" string="Scrap Locations" domain="[('location_id.scrap_location','=',1)]"/>
<separator orientation="vertical"/>
<field name="product_id"/>
</group>
<newline/>
<separator orientation="vertical"/>
<field name="product_id" select="1" widget="selection"/>
<field name="location_id" select="1" widget="selection"/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="location_id" widget = "selection"/>
<field name="location_dest_id" widget = "selection"/>
<field name="date_planned"/>
</group>
<newline/>
<group expand="1" string="Group By..." >
<filter string="Product" icon="terp-stock" context="{'group_by':'product_id'}"/>
<filter string="Location" icon="terp-stock" context="{'group_by':'location_id'}"/>
<filter string="Partner" name="Partner" icon="terp-stock" domain="[]" context="{'group_by':'partner_id'}"/>
<filter name="product" string="Product" icon="terp-stock" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter name="src_location" string="Source Location" icon="terp-stock" context="{'group_by':'location_id'}"/>
<filter string="Dest. Location" icon="terp-stock" context="{'group_by':'location_dest_id'}"/>
<filter string="State" icon="terp-stock" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-stock" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-stock" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-stock" context="{'group_by':'date_planned'}"/>
<filter string="Year" icon="terp-stock" context="{'group_by':'year'}"/>
</group>
</search>
@ -92,7 +112,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_stock_search"/>
<field name="context">{'search_default_product':1, 'search_default_src_location':1,'search_default_done':1,'group_by':[]}</field>
</record>
<menuitem

View File

@ -9,12 +9,12 @@
<field name="arch" type="xml">
<search string="Search Location">
<group col="10" colspan="4">
<filter icon="terp-stock" string="Internal Locations" domain="[('location_id.usage', '=', 'internal')]" help="Internal Locations" default="1" />
<filter icon="terp-stock" name="internal_locations" string="Internal Locations" domain="[('location_id.usage', '=', 'internal')]" help="Internal Locations"/>
<filter icon="terp-stock" string="Customer Locations" domain="[('location_id.usage', '=', 'customer')]" help="Customer Locations" />
<filter icon="terp-stock" string="Supplier Locations" domain="[('location_id.usage', '=', 'supplier')]" help="Supplier Locations" />
<separator orientation="vertical"/>
<field name="location_id" select="1"/>
<field name="product_id" select="1" default="1"/>
<field name="location_id"/>
<field name="product_id"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">
@ -73,7 +73,7 @@
<field name="res_model">stock.report.prodlots</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'full':'1'}</field>
<field name="context">{'full':'1','search_default_internal_locations':1}</field>
<field name="search_view_id" ref="view_stock_report_prodlots_filter" />
</record>
<record id="stock_report_tracklots_tree" model="ir.ui.view">
@ -155,8 +155,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Dates of Inventories">
<filter icon="gtk-media-rewind" string="Stockable"
default="1"
<filter icon="gtk-media-rewind" name="stockable" string="Stockable"
domain="[('product_id.type','=', 'product')]"/>
<filter icon="gtk-media-rewind" string="Consumable"
domain="[('product_id.type','=', 'consumable')]"/>
@ -164,8 +163,8 @@
<filter icon="gtk-media-rewind" string="Non Inv"
domain="[('date','=', False)]"/>
<separator orientation="vertical"/>
<field name="product_id" select="1"/>
<field name="date" select="1" />
<field name="product_id"/>
<field name="date"/>
</search>
</field>
</record>
@ -187,6 +186,7 @@
<field name="name">Dates of Latest Inventories by Product</field>
<field name="res_model">report.stock.lines.date</field>
<field name="view_type">form</field>
<field name="context">{'search_default_stockable':1}</field>
<field name="view_mode">tree,form</field>
</record>

View File

@ -350,7 +350,19 @@ stock_location()
class stock_tracking(osv.osv):
_name = "stock.tracking"
_description = "Stock Tracking Lots"
def get_create_tracking_lot(self, cr, uid, ids, tracking_lot):
tracking_lot_list = self.search(cr, uid, [('name', '=', tracking_lot)],
limit=1)
if tracking_lot_list:
tracking_lot = tracking_lot_list[0]
tracking_obj = self.browse(cr, uid, tracking_lot)
if not tracking_obj:
tracking_lot_vals = {
'name': tracking_lot
}
tracking_lot = self.create(cr, uid, tracking_lot_vals)
return tracking_lot
def checksum(sscc):
salt = '31' * 8 + '3'
sum = 0
@ -1014,7 +1026,7 @@ class stock_picking(osv.osv):
delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context)
delivery_id = delivery_obj.create(cr, uid, {
'name': delivered_pack.name,
'name': delivered_pack.name or move.name,
'partner_id': partner_id,
'address_id': address_id,
'date': delivery_date,
@ -1185,7 +1197,7 @@ class stock_move(osv.osv):
'date': fields.datetime('Created Date'),
'date_planned': fields.datetime('Date', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'product_qty': fields.float('Quantity', required=True),
@ -1263,7 +1275,8 @@ class stock_move(osv.osv):
'scraped' : lambda *a: False,
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c)
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
def copy(self, cr, uid, id, default=None, context={}):
@ -1502,9 +1515,12 @@ class stock_move(osv.osv):
#self.action_cancel(cr,uid, ids2, context)
return True
def action_done(self, cr, uid, ids, context=None):
def action_done(self, cr, uid, ids, context={}):
track_flag = False
picking_ids = []
product_uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
move_obj = self.pool.get('account.move')
for move in self.browse(cr, uid, ids):
if move.picking_id: picking_ids.append(move.picking_id.id)
if move.move_dest_id.id and (move.state != 'done'):
@ -1566,7 +1582,6 @@ class stock_move(osv.osv):
journal_id = move.product_id.categ_id.property_stock_journal.id
if acc_src != acc_dest:
ref = move.picking_id and move.picking_id.name or False
product_uom_obj = self.pool.get('product.uom')
default_uom = move.product_id.uom_id.id
date = time.strftime('%Y-%m-%d')
q = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
@ -1574,11 +1589,11 @@ class stock_move(osv.osv):
amount = q * move.price_unit
# Base computation on valuation price type
else:
company_id=move.company_id.id
context['currency_id']=move.company_id.currency_id.id
pricetype=self.pool.get('product.price.type').browse(cr,uid,move.company_id.property_valuation_price_type.id)
amount_unit=move.product_id.price_get(pricetype.field, context)[move.product_id.id]
amount=amount_unit * q or 1.0
company_id = move.company_id.id
context['currency_id'] = move.company_id.currency_id.id
pricetype = price_type_obj.browse(cr,uid,move.company_id.property_valuation_price_type.id)
amount_unit = move.product_id.price_get(pricetype.field, context)[move.product_id.id]
amount = amount_unit * q or 1.0
# amount = q * move.product_id.standard_price
partner_id = False
@ -1604,16 +1619,25 @@ class stock_move(osv.osv):
'date': date,
'partner_id': partner_id})
]
self.pool.get('account.move').create(cr, uid, {
move_obj.create(cr, uid, {
'name': move.name,
'journal_id': journal_id,
'line_id': lines,
'ref': ref,
})
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
for pick in self.pool.get('stock.picking').browse(cr, uid, picking_ids):
tracking_lot = False
if context:
tracking_lot = context.get('tracking_lot', False)
if tracking_lot:
rec_id = context and context.get('active_id', False)
tracking = self.pool.get('stock.tracking')
tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'), 'tracking_id': tracking_lot or False})
picking_obj = self.pool.get('stock.picking')
for pick in picking_obj.browse(cr, uid, picking_ids):
if all(move.state == 'done' for move in pick.move_lines):
self.pool.get('stock.picking').action_done(cr, uid, [pick.id])
picking_obj.action_done(cr, uid, [pick.id])
wf_service = netsvc.LocalService("workflow")
for id in ids:
@ -1829,7 +1853,8 @@ class stock_move(osv.osv):
partner_id = partial_datas.get('partner_id', False)
address_id = partial_datas.get('address_id', False)
delivery_date = partial_datas.get('delivery_date', False)
tracking_lot = context.get('tracking_lot', False)
new_moves = []
complete, too_many, too_few = [], [], []
@ -1845,6 +1870,10 @@ class stock_move(osv.osv):
product_price = partial_data.get('product_price',0.0)
product_currency = partial_data.get('product_currency',False)
if move.product_qty == product_qty:
self.write(cr, uid, move.id,
{
'tracking_id': tracking_lot
})
complete.append(move)
elif move.product_qty > product_qty:
too_few.append(move)
@ -1889,6 +1918,7 @@ class stock_move(osv.osv):
'state': 'assigned',
'move_dest_id': False,
'price_unit': move.price_unit,
'tracking_id': tracking_lot,
})
complete.append(self.browse(cr, uid, new_move))
self.write(cr, uid, move.id,
@ -1901,13 +1931,14 @@ class stock_move(osv.osv):
for move in too_many:
self.write(cr, uid, move.id,
{
'product_qty': product_qty,
'product_uos_qty': product_qty
'product_qty': move.product_qty,
'product_uos_qty': move.product_qty,
'tracking_id': tracking_lot
})
complete.append(move)
for move in complete:
self.action_done(cr, uid, [move.id])
self.action_done(cr, uid, [move.id], context)
# TOCHECK : Done picking if all moves are done
cr.execute("""

View File

@ -50,9 +50,9 @@
<field name="arch" type="xml">
<search string="Search Inventory">
<group col="10" colspan="4">
<field name="name" select="1" />
<field name="date" select="1" />
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="name"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="4">
@ -83,28 +83,28 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Lot Inventory">
<field name="name" select="1"/>
<field name="date" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="name"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<notebook colspan="4">
<page string="General Informations">
<field colspan="4" name="inventory_line_id" nolabel="1" widget="one2many_list">
<tree string="Inventory Lines" editable="bottom">
<field context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1" domain="[('type','&lt;&gt;','service')]"/>
<field context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="prod_lot_id" groups="base.group_extended"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field name="state" invisible="1"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="base.group_extended"
type="action" icon="gtk-justify-fill" states="draft"/>
</tree>
<form string="Inventory Lines">
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1" domain="[('type','&lt;&gt;','service')]"/>
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field domain="[('usage','=','internal')]" name="location_id" select="1"/>
<field domain="[('usage','=','internal')]" name="location_id"/>
<field name="prod_lot_id" groups="base.group_extended"/>
<group colspan="2" col="3">
<button name="%(stock.action_view_stock_inventory_line_split)d"
@ -117,7 +117,7 @@
<field colspan="4" name="move_ids" nolabel="1"/>
</page>
</notebook>
<field name="state" select="1"/>
<field name="state"/>
<group col="4" colspan="2">
<button name="action_done" states="draft" string="Confirm Inventory" type="object" icon="gtk-apply"/>
<button name="action_cancel" states="cancel" string="Set to Draft" type="object" icon="gtk-cancel"/>
@ -192,9 +192,9 @@
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<tree colors="grey:not active" string="Tracking Number">
<field name="name" select="1"/>
<field name="serial" select="1"/>
<field name="date" select="1"/>
<field name="name" />
<field name="serial" />
<field name="date" />
</tree>
</field>
</record>
@ -236,10 +236,10 @@
<form string="Production Lot">
<notebook colspan="4">
<page string="Production Lot">
<field name="name" select="1"/>
<field name="name"/>
<field name="ref"/>
<field name="prefix" select="1"/>
<field name="product_id" select="1"/>
<field name="prefix"/>
<field name="product_id"/>
<field name="stock_available"/>
<field name="date"/>
<field colspan="4" name="revisions" nolabel="1"/>
@ -273,11 +273,11 @@
<group col="10" colspan="4">
<filter icon="terp-stock" name="available" string="Available" domain="[('stock_available', '&gt;', 0)]" help="Available Product Lots" />
<separator orientation="vertical"/>
<field name="prefix" select="1"/>
<field name="name" select="1"/>
<field name="ref" select="1"/>
<field name="product_id" select="1"/>
<field name="date" select="1"/>
<field name="prefix"/>
<field name="name"/>
<field name="ref"/>
<field name="product_id"/>
<field name="date"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
@ -308,16 +308,17 @@
<field name="field_parent">move_history_ids</field>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Moves">
<field name="product_id" select="1"/>
<field name="product_qty" select="1"/>
<field name="product_uom" select="1" string="UOM"/>
<field name="prodlot_id" select="1" groups="base.group_extended"/>
<field name="product_id" />
<field name="product_qty" />
<field name="product_uom" string="UOM"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>
<field name="picking_id"/>
<field name="location_id" select="1"/>
<field name="location_dest_id" select="1"/>
<field name="date" select="1"/>
<field name="date_planned" select="1" string="Date"/>
<field name="location_id" />
<field name="location_dest_id" />
<field name="date"/>
<field name="date_planned" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
</tree>
</field>
@ -330,16 +331,17 @@
<field name="field_parent">move_history_ids2</field>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Moves">
<field name="product_id" select="1"/>
<field name="product_qty" select="1"/>
<field name="product_uom" select="1" string="UOM"/>
<field name="prodlot_id" select="1" groups="base.group_extended"/>
<field name="product_id" />
<field name="product_qty" />
<field name="product_uom" string="UOM"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>
<field name="picking_id"/>
<field name="location_id" select="1"/>
<field name="location_dest_id" select="1"/>
<field name="date" select="1"/>
<field name="date_planned" select="1" string="Date"/>
<field name="location_id" />
<field name="location_dest_id" />
<field name="date" />
<field name="date_planned" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
</tree>
</field>
@ -400,12 +402,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Stock location">
<field name="name" select="1"/>
<field name="name"/>
<field name="active" groups="base.group_extended"/>
<newline/>
<field name="usage" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="account_id" select="1" groups="base.group_extended"/>
<field name="usage"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="account_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="icon" groups="base.group_extended"/>
@ -599,14 +601,16 @@
<field name="arch" type="xml">
<form string="Picking list">
<group colspan="4" col="6">
<field name="name" select="1" readonly="1"/>
<!-- <field name="address_id" select="1" context="{'contact_display' : 'partner'}" groups="base.group_extended"/>-->
<field name="name" readonly="1"/>
<!-- <field name="address_id" context="{'contact_display' : 'partner'}" groups="base.group_extended"/>-->
<field name="origin"/>
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date"/>
<field name="min_date" select="1"/>
<field name="min_date"/>
<field name="type"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -616,11 +620,12 @@
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
<field name="picking_id" select="1"/>
<field name="picking_id"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
<button
name="%(stock.track_line)d"
@ -637,17 +642,18 @@
<notebook colspan="4">
<page string="General Information">
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_id" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field colspan="4" invisible="1" name="name" select="1"/>
<field colspan="4" invisible="1" name="name"/>
<field invisible="1" name="date"/>
<field name="date_planned"/>
<field name="address_id" select="1" context="{'contact_display':'partner'}"/>
<field name="date_expected" string="Date Expected"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
@ -659,7 +665,7 @@
<button name="%(track_line)d" string="Split in production lots" type="action" icon="gtk-justify-fill"/>
<button name="%(move_scrap)d" string="Scrap Move Line" type="action" icon="gtk-justify-fill"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="state"/>
<group colspan="2">
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-no"/>
@ -710,10 +716,10 @@
<separator orientation="vertical"/>
<filter icon="terp-stock" string="Back Order" domain="[('backorder_id', '!=', False)]" help="Has Back Order" />
<separator orientation="vertical"/>
<field name="location_id" select="1"/>
<field name="location_dest_id" select="1"/>
<field name="name" select="1"/>
<field name="address_id" select="1"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="name"/>
<field name="address_id"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
@ -732,12 +738,12 @@
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');grey:state in ('cancel', 'done');red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list">
<field name="name"/>
<field name="address_id" select="1"/>
<field name="address_id"/>
<field name="backorder_id" groups="base.group_extended"/>
<field name="origin"/>
<field name="date" select="1"/>
<field name="min_date" select="1"/>
<field name="state" select="1"/>
<field name="date"/>
<field name="min_date"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Delivery"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the delivery. Do you want to continue?"/>
</tree>
@ -750,13 +756,13 @@
<field name="arch" type="xml">
<form string="Picking list">
<group col="6" colspan="4">
<field name="name" select="1" readonly="1"/>
<field name="address_id" select="1"/>
<field name="name" readonly="1"/>
<field name="address_id"/>
<field name="origin"/>
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date" />
<field name="min_date" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="min_date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -766,11 +772,12 @@
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
<field name="picking_id" select="1"/>
<field name="picking_id" />
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
<button
name="%(stock.track_line)d"
@ -787,24 +794,25 @@
<notebook colspan="4">
<page string="General Information">
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field name="location_id" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field colspan="4" invisible="1" name="name" select="1"/>
<field colspan="4" invisible="1" name="name"/>
<field invisible="1" name="date"/>
<field name="date_planned"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<field name="date_expected" string="Date Expected"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<field groups="base.group_extended" name="tracking_id"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="state"/>
<group colspan="2">
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/>
@ -834,7 +842,7 @@
<field name="auto_picking"/>
<field name="active"/>
<newline/>
<field name="date" select="1"/>
<field name="date"/>
<field name="date_done"/>
<field name="move_type"/>
</page>
@ -855,9 +863,9 @@
<separator orientation="vertical"/>
<filter icon="terp-stock" string="Back Order" domain="[('backorder_id','!=',False)]" help="Back Order"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="address_id" select="1"/>
<field name="origin" select="1"/>
<field name="name"/>
<field name="address_id"/>
<field name="origin"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">
@ -930,11 +938,11 @@
<group col="6" colspan="4">
<field name="address_id"/>
<field name="min_date"/>
<field name="name" select="1" readonly="1"/>
<field name="name" readonly="1"/>
<field name="invoice_state"/>
<field name="backorder_id" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -944,11 +952,12 @@
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
<field name="picking_id" select="1"/>
<field name="picking_id"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
<button
name="%(stock.track_line)d"
@ -965,26 +974,27 @@
<notebook colspan="4">
<page string="General Information">
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" />
<field name="product_uom" select="1"/>
<field name="location_id" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" />
<field name="product_uom"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field colspan="4" invisible="1" name="name" select="1"/>
<field colspan="4" invisible="1" name="name"/>
<field invisible="1" name="date"/>
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<field name="prodlot_id" select="1" groups="base.group_extended"
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<field groups="base.group_extended" name="tracking_id"/>
<label/>
<button name="%(track_line)d" string="Split in production lots" type="action" icon="gtk-justify-fill"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="state"/>
<group colspan="2">
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-no"/>
@ -1033,9 +1043,11 @@
<filter icon="terp-stock" string="Available" domain="[('state','=','assigned')]" help="Assigned Outgoing Orders"/>
<filter icon="terp-stock" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Outgoing Orders"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="address_id" select="1"/>
<!-- <field name="company_id" select="1" widget="selection"/>-->
<field name="name"/>
<field name="address_id" />
<!-- <field name="company_id" widget="selection"/>-->
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
@ -1103,7 +1115,8 @@
<field name="arch" type="xml">
<form string="Input Picking List">
<group colspan="4" col="6">
<field name="name" readonly="1" select="1"/>
<field name="name" readonly="1"/>
<field name="address_id" on_change="onchange_partner_in(address_id)" context="{'contact_display':'partner'}" />
<field name="origin"/>
<field name="backorder_id" readonly="1" groups="base.group_extended"/>
@ -1111,7 +1124,7 @@
<field name="type"/>
<field name="min_date" readonly="1"/>
<field name="invoice_state" string="Invoice Control"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -1137,29 +1150,30 @@
<notebook colspan="4">
<page string="General Information">
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field domain="[('usage','=','internal')]" name="location_dest_id" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field name="location_id" domain="[('usage','&lt;&gt;','view')]"/>
<field domain="[('usage','=','internal')]" name="location_dest_id" />
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field colspan="4" invisible="1" name="name" select="1"/>
<field colspan="4" invisible="1" name="name" />
<field groups="base.group_extended" name="date_planned"/>
<field name="date_expected" groups="base.group_extended" string="Date Expected"/>
<newline/>
<newline/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<newline/>
<field name="prodlot_id" select="1" groups="base.group_extended"
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<field groups="base.group_extended" name="tracking_id"/>
<newline/>
<label/>
<button groups="base.group_extended" name="%(track_line)d" string="Split in production lots" type="action" icon="gtk-justify-fill"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="state"/>
<group colspan="2">
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon=""/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon=""/>
@ -1205,9 +1219,9 @@
<separator orientation="vertical" />
<filter icon="terp-stock" string="Back Order" domain="[('backorder_id', '!=', False)]" help="Has Back Order" groups="base.group_extended"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="address_id" select="1"/>
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company" />
<field name="name"/>
<field name="address_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company" />
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
@ -1264,9 +1278,9 @@
<filter icon="terp-stock" string="Available" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
<filter icon="terp-stock" name="confirmed" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves" />
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="origin" select="1"/>
<field name="company_id" select="1" widget="selection"/>
<field name="name"/>
<field name="origin"/>
<field name="company_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
@ -1302,12 +1316,14 @@
<field name="name" string="Move Name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit Of Measure"/>
<field name="product_uom" string="Unit Of Measure"/>
<field name="picking_id" select="1"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="state"/>
</tree>
</field>
@ -1327,7 +1343,7 @@
<group colspan="2" col="2">
<separator colspan="2" string="Move Information"/>
<field name="name"/>
<field name="product_id" select="1" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit Of Measure" widget="selection"/>
<field name="product_uos" groups="base.group_extended" />
@ -1335,23 +1351,24 @@
<group colspan="2" col="2">
<separator string="Locations &amp; Picking" colspan="2" />
<field name="location_id" select="1" widget="selection"/>
<field name="location_dest_id" select="1" widget="selection"/>
<field name="location_id" widget="selection"/>
<field name="location_dest_id" widget="selection"/>
<field name="picking_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group colspan="2" col="2">
<separator string="Dates &amp; Priority" colspan="2" />
<field name="date"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="priority"/>
</group>
<group colspan="2" col="4">
<separator string="Traceability" colspan="4" />
<field name="tracking_id" select="1" colspan="4" />
<field name="tracking_id" colspan="4" />
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
@ -1364,7 +1381,7 @@
</page>
</notebook>
<group col="6" colspan="4">
<field name="state" select="1"/>
<field name="state"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
@ -1431,9 +1448,11 @@
<field name="product_uom" string="Uint Of Measure"/>
<field name="prodlot_id" string="Lot" groups="base.group_extended"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="backorder_id" groups="base.group_extended"/>
<field name="state"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
</tree>
</field>
@ -1459,6 +1478,7 @@
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="priority"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<newline/>
@ -1507,6 +1527,10 @@
<field name="product_id"/>
</group>
<newline/>
<group col='8' colspan='14' expand="1" string="Tracking Lots">
<field name="tracking_id" context="{'tracking_lot': self}" />
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="Product" icon="terp-stock" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="State" icon="terp-stock" domain="[]" context="{'group_by':'state'}"/>

View File

@ -0,0 +1,347 @@
-
In order to test the stock module, I will create product,
create physical inventory ,fill inventory lines from location,split inventory line into production lot
-
I create Asset Account Type.
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: cash
name: Cash
sign: 1
-
I create Receivable Account Type.
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
I create Receivable Account .
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Expense Account.
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
type: consolidation
user_type: account_account_type_asset0
-
I create Product Sale Account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: stock.account_account_type_income0
-
I create Product Purchase Account.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
I create partner.
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
I create partner.
-
!record {model: res.partner, id: res_partner_diasorinltd0}:
address:
- country_id: base.in
street: Ash House, Ash Road
name: DiaSorin Ltd
supplier: true
-
I create partner.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
supplier: true
-
I create partner address.
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: stock.res_partner_diasorinltd0
street: Ash House, Ash Road
title: Ms.
-
I create product.category .
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product HP Pavilion Desktop PCs .
-
!record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
categ_id: stock.product_category_computer0
cost_method: standard
mes_type: fixed
list_price: 1000.0
name: HP Pavilion Desktop PCs
procure_method: make_to_stock
seller_ids:
- delay: 1
name: stock.res_partner_shawtrust0
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productsale0
property_account_income: account_account_productsale0
-
I create product HP CD writers.
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: stock.product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_shawtrust0
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
-
I create Physical Inventory for the products.
-
!record {model: stock.inventory, id: stock_inventory_physicalinventoy0}:
company_id: base.main_company
date: '2010-05-10 18:19:13'
date_done: '2010-05-10 18:19:59'
inventory_line_id:
- company_id: base.main_company
location_id: stock.stock_location_stock
product_id: stock.product_product_hpcdwriters0
product_qty: 10.0
product_uom: product.product_uom_unit
- company_id: base.main_company
location_id: stock.stock_location_stock
product_id: stock.product_product_hppaviliondesktoppcs0
product_qty: 10.0
product_uom: product.product_uom_unit
name: Physical inventory
state: draft
-
I confirm the Inventory for HP CD writers.
-
!python {model: stock.inventory}: |
self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
-
I create stock.fill.inventory .
-
!record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
location_id: stock.stock_location_stock
-
I fill inventory for HP CD writers.
-
!python {model: stock.fill.inventory}: |
self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US',
"full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
[ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), })
-
I create stock.move.split record.
-
!record {model: stock.move.split, id: stock_move_split_0}:
line_ids:
- name: '00001'
quantity: 5
product_id: stock.product_product_hpcdwriters0
-
I Split into production line.
-
!python {model: stock.move.split}: |
move_obj=self.pool.get('stock.move')
product_obj=self.pool.get('product.product')
product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')])
move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)])
self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model":
"stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0]
})
-
In Order to test the picking I create picking with move lines.
-
!record {model: stock.picking, id: stock_picking_0}:
address_id: res_partner_address_0
company_id: base.main_company
date: '2010-05-11 15:18:52'
invoice_state: none
move_lines:
- company_id: base.main_company
date_planned: '2010-05-11 15:18:57'
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
name: HP CD writers
product_id: stock.product_product_hpcdwriters0
product_qty: 3.0
product_uom: product.product_uom_unit
date: '2010-05-11 15:18:57'
product_uos_qty: 3.0
move_type: direct
type: internal
-
I click on draft_force_assign on picking.
-
!python {model: stock.picking}: |
self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
"partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
ref("stock.menu_action_picking_tree6"), })
-
I click on force_assign on picking.
-
!python {model: stock.picking}: |
self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
"partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
ref("stock.menu_action_picking_tree6"), })
-
I confirm the picking.
-
!python {model: stock.picking }: |
import time
pick=self.browse(cr,uid,ref('stock_picking_0'))
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d')
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)

View File

@ -23,8 +23,8 @@ import stock_traceability
import stock_move
import stock_partial_picking
import stock_partial_move
import wizard_replacement
import wizard_ups
import stock_replacement
import stock_ups
import stock_inventory_merge
import stock_inventory_set_stock_zero
import stock_fill_inventory

View File

@ -30,3 +30,4 @@
</data>
</openerp>

View File

@ -186,6 +186,12 @@ class stock_partial_move(osv.osv_memory):
return res
def do_partial(self, cr, uid, ids, context):
rec_id = context and context.get('active_id', False)
tracking_lot = context.get('tracking_lot', False)
if tracking_lot:
tracking = self.pool.get('stock.tracking')
tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
context ['tracking_lot'] = tracking_lot
move_obj = self.pool.get('stock.move')
move_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
@ -208,7 +214,6 @@ class stock_partial_move(osv.osv_memory):
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
})
res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
return {}

View File

@ -0,0 +1,68 @@
# -*- 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.translate import _
import netsvc
import pooler
import time
import wizard
class stock_replacement(osv.osv_memory):
"""
This class has been defined for replacement wizard
"""
_name = "stock.replacement"
_description = "Stock Replacement"
def get_composant(self, cr, uid, ids, context = {}):
return {}
def replace_composant(self, cr, uid, ids, context = {}):
"""
to open a new wizard that acknowledge, a replacement task
@return: it returns the replacement acknowledgement form
"""
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.replacement.result',
'type': 'ir.actions.act_window',
'target':'new',
}
stock_replacement()
class stock_replacement_result(osv.osv_memory):
"""
This class has been defined for replacement result
"""
_name = "stock.replacement.result"
_description = "Stock Replacement result"
stock_replacement_result()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_stock_replacement" model="ir.ui.view">
<field name="name">Stock Replacement</field>
<field name="model">stock.replacement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Replace a component">
<label string="Component" colspan="4"/>
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button name="replace_composant" string="Replace" type="object" />
</form>
</field>
</record>
<act_window name="Stock Replacement"
res_model="stock.replacement"
src_model=""
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_stock_replacement"/>
<record id="view_stock_replacement_result" model="ir.ui.view">
<field name="name">Stock Replacement result</field>
<field name="model">stock.replacement.result</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Replace result">
<label string="Replacing successful !" colspan="4"/>
<separator string="" colspan="4" />
<button special="cancel" string="Ok" />
</form>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,91 @@
# -*- 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.translate import _
import netsvc
import pooler
import time
import wizard
class stock_ups(osv.osv_memory):
_name = "stock.ups"
_description = "Stock ups"
def ups_save(self, cr, uid, ids, context = {}):
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.final',
'type': 'ir.actions.act_window',
'target':'new',
}
def ups_upload(self, cr, uid, ids, context = {}):
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.upload',
'type': 'ir.actions.act_window',
'target':'new',
}
_columns = {
'weight': fields.float('Lot weight', required=True),
}
_defaults = {
'weight': lambda *a: 3.0,
}
stock_ups()
class stock_ups_final(osv.osv_memory):
_name = "stock.ups.final"
_description = "Stock ups final"
def create_xmlfile(self, cr, uid, ids, context = {}):
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
return {'xmlfile' : report.create(uid, context['active_id'], ids, {})}
_columns = {
'xmlfile': fields.binary('XML File'),
}
stock_ups_final()
class stock_ups_upload(osv.osv_memory):
_name = "stock.ups.upload"
_description = "Stock ups upload"
def upload_xmlfile(self, cr, uid, ids, context = {}):
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
#FIXME: this seems unfinished
fp = file('/tmp/test.xml', 'w').write(report.create(uid, context['active_id'], ids, {}))
return {}
stock_ups_upload()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_stock_ups" model="ir.ui.view">
<field name="name">Stock ups</field>
<field name="model">stock.ups</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="UPS XML generator">
<separator string="UPS generator" colspan="4"/>
<field name="weight" />
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button name="ups_save" string="Get xml file" type="object" />
<button name="ups_upload" string="Upload xml file" type="object" />
</form>
</field>
</record>
<record id="view_stock_ups_final" model="ir.ui.view">
<field name="name">Stock ups</field>
<field name="model">stock.ups.final</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="UPS XML generator">
<separator string="Save the attached file" colspan="4" />
<field name="xmlfile" />
<button special="cancel" string="End" />
<button name="create_xmlfile" string="create xml file" type="object" />
</form>
</field>
</record>
<record id="view_stock_ups_upload" model="ir.ui.view">
<field name="name">Stock ups</field>
<field name="model">stock.ups.upload</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="UPS XML generator">
<separator string="File uploaded" colspan="4" />
<button special="cancel" string="End" />
<button name="upload_xmlfile" string="Upload xml file" type="object" />
</form>
</field>
</record>
<act_window name="Stock ups"
res_model="stock.ups"
src_model=""
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_stock_ups"/>
</data>
</openerp>

View File

@ -1,60 +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 wizard
class wizard_replacement(wizard.interface):
def getComposant(self, cr, uid, data, context):
return {}
def replaceComposant(self, cr, uid, data, context):
return {}
comp_form = '''<?xml version="1.0"?><form string="Replace a component"><label string="Component" colspan="4"/></form>'''
comp_fields = {}
replace_form = '''<?xml version="1.0"?><form string="Replace result"><label string="Replacing successful !" colspan="4" /></form>'''
replace_fields = {}
states = {
'init' : {
'actions' : [getComposant],
'result' : {
'type' : 'form',
'arch' : comp_form,
'fields' : comp_fields,
'state' : [('end', 'Cancel'), ('replace', 'Replace')]}
},
'replace' : {
'action' : [replaceComposant],
'result' : {
'type' : 'form',
'arch' : replace_form,
'fields' : replace_fields,
'state' : [('end', 'Ok')]}
},
}
wizard_replacement('stock.move.replace')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,85 +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 os
import wizard
import netsvc
import time
_ups_form = '''<?xml version="1.0"?>
<form string="UPS XML generator">
<separator string="UPS generator" colspan="4"/>
<field name="weight" />
</form>'''
_ups_fields = {
'weight' : { 'string' : 'Lot weight', 'type' : 'float', 'default' : lambda *a: 3.0, 'required' : True },
}
_ups_finalform = '''<?xml version="1.0"?>
<form string="UPS XML generator">
<separator string="Save the attached file" colspan="4" />
<field name="xmlfile" />
</form>'''
_ups_finalfields = {
'xmlfile' : { 'string' : 'XML File', 'type' : 'binary' },
}
_ups_uploadform = '''<?xml version="1.0"?>
<form string="UPS XML generator">
<separator string="File uploaded" colspan="4" />
</form>'''
_ups_uploadfields = {}
def create_xmlfile(self, cr, uid, data, context):
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
return {'xmlfile' : report.create(uid, data['ids'], data, {})}
def upload_xmlfile(self, cr, uid, data, context):
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
#FIXME: this seems unfinished
fp = file('/tmp/test.xml', 'w').write(report.create(uid, data['ids'], data, {}))
return {}
class wiz_ups(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch' : _ups_form, 'fields' : _ups_fields, 'state':[('end','Cancel'),('ups_save','Get xml file'), ('ups_upload', 'Upload xml file')]}
},
'ups_save': {
'actions': [create_xmlfile],
'result': {'type': 'form', 'arch' : _ups_finalform, 'fields' : _ups_finalfields, 'state':[('end', 'End')]}
},
'ups_upload' : {
'actions' : [upload_xmlfile],
'result' : {'type' : 'form', 'arch' : _ups_uploadform, 'fields' : _ups_uploadfields, 'state' : [('end', 'End')]}
},
}
wiz_ups('stock.ups_xml');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -42,6 +42,9 @@ This module may be useful for different purposes:
'update_xml': ['stock_view.xml', 'security/ir.model.access.csv'],
'demo_xml': [],
'installable': True,
'test':[
# 'test/stock_location.yml'
],
'active': False,
'certificate': '0046505115101',
}

View File

@ -0,0 +1,273 @@
-
In order to test the stock location module, I will create product, locations, SO, warehouse.
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
Creating a account.account record
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Jouran
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
Creating a account.account record
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
type: consolidation
user_type: account_account_type_asset0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account_account_type_income0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_diasorinltd0}:
address:
- country_id: base.in
street: Ash House, Ash Road
name: DiaSorin Ltd
supplier: true
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
supplier: true
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: Ms.
-
Creating a product.category record
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
allocation_method: fifo
chained_auto_packing: auto
chained_delay: 15
chained_location_type: none
company_id: base.main_company
name: Suppiler1
usage: supplier
-
Creating a product.product record
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_shawtrust0
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
path_ids:
- auto: auto
delay: 30
location_dest_id: stock.location_inventory
location_from_id: stock_location_suppiler0
pricelist_sale: 'Public Pricelist (0.00) : 1.00\n'
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
address_id: res_partner_address_0
allocation_method: fifo
chained_auto_packing: manual
chained_delay: 20
chained_location_type: none
company_id: base.main_company
name: Suppiler 1
usage: internal
-
I create warehouse.
-
!record {model: stock.warehouse, id: warehouse0}:
company_id: base.main_company
lot_input_id: stock.stock_location_stock
lot_output_id: stock_location_suppiler0
lot_stock_id: stock_location_suppiler0
name: OpenERP S.A.
partner_address_id: res_partner_address_0
-
I create Sale order for HP CD writers.
-
!record {model: sale.order, id: sale_order_01}:
date_order: '2010-04-20'
invoice_quantity: order
name: Test/location
order_line:
- name: HP CD writers
price_unit: 1000.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
product_id: product_product_hpcdwriters0
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_01}
-
I check the delay mentioned in pushed flow in move.
-
!python {model: stock.move}: |
product_id=self.pool.get('product.product').search(cr,uid,[('name','=','HP CD writers')])
location_id=self.pool.get('stock.location').search(cr,uid,[('name','=','Inventory loss')])
move_ids =self.search(cr, uid, [('product_id','in',product_id),('location_dest_id','=',location_id)])
if move_ids:
move_obj=self.browse(cr,uid,move_ids)[0]
import time
from_dt = time.mktime(time.strptime(move_obj.date,'%Y-%m-%d %H:%M:%S'))
to_dt = time.mktime(time.strptime(move_obj.date_planned,'%Y-%m-%d %H:%M:%S'))
diff_day = (to_dt-from_dt)/(3600*24)
assert (round(diff_day)+1 ==30)

View File

@ -161,6 +161,7 @@ class stock_sale_forecast_createlines(osv.osv_memory):
def create_forecast(self,cr, uid, ids, context={}):
product_obj = self.pool.get('product.product')
forecast_obj=self.pool.get('stock.sale.forecast')
mod_obj =self.pool.get('ir.model.data')
for f in self.browse(cr, uid, ids, context):
prod_categ_obj=self.pool.get('product.category')
template_obj=self.pool.get('product.template')
@ -212,11 +213,14 @@ class stock_sale_forecast_createlines(osv.osv_memory):
'product_uom_categ' : p.uom_id.category_id.id,
'product_uos_categ' : prod_uos_categ,
})
result = mod_obj._get_id(cr, uid, 'stock_planning', 'view_stock_sale_forecast_filter')
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
return {
'view_type': 'form',
"view_mode": 'tree',
'res_model': 'stock.sale.forecast',
'type': 'ir.actions.act_window',
'type': 'ir.actions.act_window',
'search_view_id': id['res_id'],
}
stock_sale_forecast_createlines()
@ -488,7 +492,7 @@ class stock_planning_createlines(osv.osv_memory):
def create_planning(self,cr, uid, ids, context={}):
product_obj = self.pool.get('product.product')
planning_obj=self.pool.get('stock.planning')
mod_obj =self.pool.get('ir.model.data')
for f in self.browse(cr, uid, ids, context=context):
if f.forecasted_products:
cr.execute("SELECT product_id \
@ -562,11 +566,14 @@ class stock_planning_createlines(osv.osv_memory):
'stock_supply_location': stock_supply_location,
})
result = mod_obj._get_id(cr, uid, 'stock_planning', 'view_stock_planning_filter')
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
return {
'view_type': 'form',
"view_mode": 'tree',
'res_model': 'stock.planning',
'type': 'ir.actions.act_window',
'type': 'ir.actions.act_window',
'search_view_id': id['res_id'],
}
stock_planning_createlines()

View File

@ -137,9 +137,9 @@
groups="base.group_multi_company"
widget="selection"
on_change="onchange_company(company_id)"/>
<field name="warehouse_id" select="1" domain = "[('company_id','=',company_id)] "/>
<field name="period_id" select="1" />
<field name="product_id" select="1" on_change="product_id_change(product_id)" />
<field name="warehouse_id" domain = "[('company_id','=',company_id)] "/>
<field name="period_id" />
<field name="product_id" on_change="product_id_change(product_id)" />
<field name="product_uom_categ" invisible = "True"/>
<field name="product_uos_categ" invisible = "True"/>
<field name="product_uom"
@ -208,9 +208,9 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Stock and Sales Forecasts" editable="bottom">
<field name="warehouse_id" select="1"/>
<field name="warehouse_id"/>
<field name="user_id"/>
<field name="period_id" select="1"/>
<field name="period_id"/>
<field name="product_id" on_change="product_id_change(product_id)" />
<field name="product_qty"/>
<field name="product_uom" />
@ -324,8 +324,8 @@
<field name="company_id" select = "1" widget= "selection"
on_change="onchange_company(company_id)" groups="base.group_multi_company"/>
<field name="warehouse_id" select="1" domain = "[('company_id','=',company_id)] " />
<field name="period_id" select="1" />
<field name="warehouse_id" domain = "[('company_id','=',company_id)] " />
<field name="period_id" />
<field name="product_id" on_change="product_id_change(product_id)" />
<field name="product_uom_categ" invisible = "True"/>
<field name="product_uos_categ" invisible = "True"/>
@ -386,10 +386,10 @@
<group col='10' colspan='4'>
<!-- Doesn't work ! <filter icon="terp-purchase" string="Current" domain="[('line_time','=','Future')]" separator="1"/> -->
<filter icon="terp-purchase" string="No Requisition" domain="[('history','=',False)]" separator="1"/>
<field name="company_id" select="1" widget="selection"/>
<field name="warehouse_id" select="1" widget="selection"/>
<field name="period_id" select="1" widget="selection"/>
<field name="product_id" select="1" widget="selection"/>
<field name="company_id" widget="selection"/>
<field name="warehouse_id" widget="selection"/>
<field name="period_id" widget="selection"/>
<field name="product_id" widget="selection"/>
</group>
</search>
</field>