Task-578: Merge the file and remove the unused code and Fix the problem of ir.rule
bzr revid: sbh@tinyerp.com-20100505104236-9zl2uy1k9r9p2c11
This commit is contained in:
parent
be4435891c
commit
33bbc9770c
|
@ -20,9 +20,8 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import pos
|
|
||||||
import account_bank_statement
|
import account_bank_statement
|
||||||
import pos_account_bank_statement
|
import pos
|
||||||
import stock
|
import stock
|
||||||
import wizard
|
import wizard
|
||||||
import report
|
import report
|
||||||
|
|
|
@ -132,8 +132,6 @@ class account_bank_statement(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||||
'balance_start': fields.function(_get_starting_balance, method=True, string='Starting Balance', type='float',digits=(16,2)),
|
'balance_start': fields.function(_get_starting_balance, method=True, string='Starting Balance', type='float',digits=(16,2)),
|
||||||
# 'balance_start': fields.float('Starting Balance',digits=(16,2)),
|
|
||||||
# 'balance_end': fields.float('Balance',digits=(16,2)),
|
|
||||||
'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirm'),('open','Open')],
|
'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirm'),('open','Open')],
|
||||||
'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
|
'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
|
||||||
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Total of Entry encoding"),
|
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Total of Entry encoding"),
|
||||||
|
@ -142,6 +140,8 @@ class account_bank_statement(osv.osv):
|
||||||
'starting_details_ids': fields.one2many('singer.statement', 'starting_id', string='Starting Details'),
|
'starting_details_ids': fields.one2many('singer.statement', 'starting_id', string='Starting Details'),
|
||||||
'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Ending Details'),
|
'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Ending Details'),
|
||||||
'name': fields.char('Name', size=64, required=True, readonly=True),
|
'name': fields.char('Name', size=64, required=True, readonly=True),
|
||||||
|
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||||
|
'user_id': fields.many2one('res.users',ondelete='cascade',string='User', readonly=True),
|
||||||
|
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -149,7 +149,8 @@ class account_bank_statement(osv.osv):
|
||||||
'name': lambda *a: '/',
|
'name': lambda *a: '/',
|
||||||
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
|
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
'journal_id': _default_journal_id,
|
'journal_id': _default_journal_id,
|
||||||
|
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||||
|
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
|
@ -210,12 +211,13 @@ class account_bank_statement(osv.osv):
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
obj_inv = self.browse(cr, uid, ids)[0]
|
obj_inv = self.browse(cr, uid, ids)[0]
|
||||||
|
sequence_obj=self.pool.get('ir.sequence')
|
||||||
s_id=obj_inv.journal_id
|
s_id=obj_inv.journal_id
|
||||||
if s_id.statement_sequence_id:
|
if s_id.statement_sequence_id:
|
||||||
s_id=s_id.id
|
s_id=s_id.id
|
||||||
number = self.pool.get('ir.sequence').get_id(cr, uid, s_id)
|
number = sequence_obj.get_id(cr, uid, s_id)
|
||||||
else:
|
else:
|
||||||
number = self.pool.get('ir.sequence').get(cr, uid,
|
number = sequence_obj.get(cr, uid,
|
||||||
'account.bank.statement')
|
'account.bank.statement')
|
||||||
|
|
||||||
self.write(cr, uid, ids, {'date':time.strftime("%Y-%m-%d %H:%M:%S"), 'state':'open', 'name':number})
|
self.write(cr, uid, ids, {'date':time.strftime("%Y-%m-%d %H:%M:%S"), 'state':'open', 'name':number})
|
||||||
|
@ -244,17 +246,8 @@ class account_bank_statement(osv.osv):
|
||||||
raise osv.except_osv(_('Invalid action !'), _(' You can not confirm your cashbox, Please enter ending details, missing value matches to "%s"')%(abs(Decimal(str(val))-(Decimal(str(val_statement_line))+Decimal(str(val2))))))
|
raise osv.except_osv(_('Invalid action !'), _(' You can not confirm your cashbox, Please enter ending details, missing value matches to "%s"')%(abs(Decimal(str(val))-(Decimal(str(val_statement_line))+Decimal(str(val2))))))
|
||||||
|
|
||||||
self.write(cr, uid, statement.id, {'balance_end_real':Decimal(str(val_statement_line))+Decimal(str(val2)),'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
self.write(cr, uid, statement.id, {'balance_end_real':Decimal(str(val_statement_line))+Decimal(str(val2)),'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
||||||
# self.write(cr, uid, statement.id, {'balance_end_real':bal_st+val_statement_line,'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
|
||||||
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context=None)
|
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context=None)
|
||||||
|
|
||||||
account_bank_statement()
|
account_bank_statement()
|
||||||
|
|
||||||
#class singer_account_bank_statement_line(osv.osv):
|
|
||||||
# _inherit = 'account.bank.statement.line'
|
|
||||||
# _columns = {
|
|
||||||
# 'pos_statement_id': fields.many2one('pos.order',ondelete='cascade'),
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
#singer_account_bank_statement_line()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,6 @@ class pos_order(osv.osv):
|
||||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order.shop_id.warehouse_id.id))
|
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order.shop_id.warehouse_id.id))
|
||||||
res=cr.fetchone()
|
res=cr.fetchone()
|
||||||
location_id=res and res[0] or None
|
location_id=res and res[0] or None
|
||||||
# location_id = order and order.shop_id and order.shop_id.warehouse_id and order.shop_id.warehouse_id.lot_stock_id.id or None
|
|
||||||
stock_dest_id = int(val.split(',')[1])
|
stock_dest_id = int(val.split(',')[1])
|
||||||
if line.qty < 0:
|
if line.qty < 0:
|
||||||
location_id, stock_dest_id = stock_dest_id, location_id
|
location_id, stock_dest_id = stock_dest_id, location_id
|
||||||
|
@ -1015,18 +1014,9 @@ class pos_order(osv.osv):
|
||||||
|
|
||||||
pos_order()
|
pos_order()
|
||||||
|
|
||||||
class account_bank_statement(osv.osv):
|
|
||||||
_inherit = 'account.bank.statement'
|
|
||||||
_columns={
|
|
||||||
'user_id': fields.many2one('res.users',ondelete='cascade',string='User', readonly=True),
|
|
||||||
}
|
|
||||||
_defaults = {
|
|
||||||
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id
|
|
||||||
}
|
|
||||||
account_bank_statement()
|
|
||||||
|
|
||||||
class account_bank_statement_line(osv.osv):
|
class account_bank_statement_line(osv.osv):
|
||||||
_inherit = 'account.bank.statement.line'
|
_inherit = 'account.bank.statement.line'
|
||||||
|
|
||||||
def _get_statement_journal(self, cr, uid, ids, context, *a):
|
def _get_statement_journal(self, cr, uid, ids, context, *a):
|
||||||
res = {}
|
res = {}
|
||||||
for line in self.browse(cr, uid, ids):
|
for line in self.browse(cr, uid, ids):
|
||||||
|
@ -1037,7 +1027,11 @@ class account_bank_statement_line(osv.osv):
|
||||||
'am_out':fields.boolean("To count"),
|
'am_out':fields.boolean("To count"),
|
||||||
'is_acc':fields.boolean("Is accompte"),
|
'is_acc':fields.boolean("Is accompte"),
|
||||||
'pos_statement_id': fields.many2one('pos.order',ondelete='cascade'),
|
'pos_statement_id': fields.many2one('pos.order',ondelete='cascade'),
|
||||||
|
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||||
}
|
}
|
||||||
|
_defaults = {
|
||||||
|
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||||
|
}
|
||||||
account_bank_statement_line()
|
account_bank_statement_line()
|
||||||
|
|
||||||
class pos_order_line(osv.osv):
|
class pos_order_line(osv.osv):
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 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 General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
from osv import osv, fields
|
|
||||||
import time
|
|
||||||
import netsvc
|
|
||||||
|
|
||||||
|
|
||||||
class account_bank_statement(osv.osv):
|
|
||||||
|
|
||||||
_inherit = 'account.bank.statement'
|
|
||||||
_columns = {
|
|
||||||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
|
||||||
}
|
|
||||||
_defaults = {
|
|
||||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
|
||||||
}
|
|
||||||
account_bank_statement()
|
|
||||||
|
|
||||||
class account_bank_statement_line(osv.osv):
|
|
||||||
|
|
||||||
def _default_company(self, cr, uid, context={}):
|
|
||||||
|
|
||||||
""" To get default company for the object"
|
|
||||||
|
|
||||||
@param self: The object pointer
|
|
||||||
@param cr: the current row, from the database cursor,
|
|
||||||
@param uid: the current user’s ID for security checks,
|
|
||||||
@param ids: List of bank statement ids
|
|
||||||
@param context: A standard dictionary for contextual values
|
|
||||||
@return: company
|
|
||||||
"""
|
|
||||||
|
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
|
||||||
if user.company_id:
|
|
||||||
return user.company_id.id
|
|
||||||
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
|
||||||
|
|
||||||
_inherit = 'account.bank.statement.line'
|
|
||||||
_columns = {
|
|
||||||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
|
||||||
}
|
|
||||||
_defaults = {
|
|
||||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
|
||||||
}
|
|
||||||
account_bank_statement_line()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
@ -175,7 +175,9 @@
|
||||||
<menuitem name="Point of Sale" id="menu_point_root" sequence="10"/>
|
<menuitem name="Point of Sale" id="menu_point_root" sequence="10"/>
|
||||||
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
|
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
|
||||||
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
|
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
|
||||||
<menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale" sequence="2" name="Products"/>
|
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="2" />
|
||||||
|
|
||||||
|
<menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>
|
||||||
|
|
||||||
<!-- POS Order view (date_payment) -->
|
<!-- POS Order view (date_payment) -->
|
||||||
<record model="ir.actions.act_window" id="action_pos_pos_form_user">
|
<record model="ir.actions.act_window" id="action_pos_pos_form_user">
|
||||||
|
|
|
@ -25,23 +25,18 @@
|
||||||
<field eval=""""shop2"""" name="login"/>
|
<field eval=""""shop2"""" name="login"/>
|
||||||
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
|
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="ir_rule_group_posline0" model="ir.rule.group">
|
|
||||||
<field name="model_id" ref="point_of_sale.model_pos_order_line"/>
|
|
||||||
<field eval=""""POS line"""" name="name"/>
|
|
||||||
<field eval="1" name="global"/>
|
|
||||||
</record>
|
|
||||||
<record id="ir_rule_0" model="ir.rule">
|
<record id="ir_rule_0" model="ir.rule">
|
||||||
<field eval=""""child_of"""" name="operator"/>
|
<field name="name">POS line</field>
|
||||||
<field eval=""""user.company_id.id"""" name="operand"/>
|
<field name="model_id" ref="model_pos_order_line"/>
|
||||||
<field name="field_id" ref="point_of_sale.field_pos_order_line_company_id"/>
|
<field name="global" eval="True"/>
|
||||||
<field name="rule_group" ref="ir_rule_group_posline0"/>
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<record id="res_groups_posuserposline0" model="res.groups">
|
<record id="res_groups_posuserposline0" model="res.groups">
|
||||||
<field eval="[(6,0,[ref('point_of_sale.menu_action_pos_order_line'),ref('point_of_sale.menu_action_pos_order_line_day')])]" name="menu_access"/>
|
<field eval="[(6,0,[ref('point_of_sale.menu_action_pos_order_line'),ref('point_of_sale.menu_action_pos_order_line_day')])]" name="menu_access"/>
|
||||||
<field eval="[(6,0,[ref('ir_rule_group_posline0')])]" name="rule_groups"/>
|
<field eval="[(6,0,[ref('ir_rule_0')])]" name="groups"/>
|
||||||
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
|
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
|
||||||
<field eval=""""POS_user_pos_line"""" name="name"/>
|
<field eval=""""POS_user_pos_line"""" name="name"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -66,42 +61,21 @@
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<record id="ir_rule_group_point0" model="ir.rule.group">
|
<record id="ir_rule_0" model="ir.rule">
|
||||||
<field name="model_id" ref="point_of_sale.model_pos_order"/>
|
<field eval=""""point"""" name="name"/>
|
||||||
<field eval=""""point"""" name="name"/>
|
<field name="model_id" ref="model_pos_order"/>
|
||||||
<field eval="1" name="global"/>
|
<field name="global" eval="True"/>
|
||||||
</record>
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
<record id="ir_rule_0" model="ir.rule">
|
</record>
|
||||||
<field eval=""""child_of"""" name="operator"/>
|
<record id="ir_rule_group_posreporting0" model="ir.rule">
|
||||||
<field eval=""""user.company_id.id"""" name="operand"/>
|
|
||||||
<field name="field_id" ref="point_of_sale.field_pos_order_company_id"/>
|
|
||||||
<field name="rule_group" ref="ir_rule_group_point0"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="ir_rule_group_poslinecompany0" model="ir.rule.group">
|
|
||||||
<field name="model_id" ref="point_of_sale.model_pos_order_line"/>
|
|
||||||
<field eval=""""POS line company"""" name="name"/>
|
|
||||||
<field eval="1" name="global"/>
|
|
||||||
</record>
|
|
||||||
<record id="ir_rule_4" model="ir.rule">
|
|
||||||
<field eval=""""child_of"""" name="operator"/>
|
|
||||||
<field eval=""""user.company_id.id"""" name="operand"/>
|
|
||||||
<field name="field_id" ref="point_of_sale.field_pos_order_line_company_id"/>
|
|
||||||
<field name="rule_group" ref="ir_rule_group_poslinecompany0"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="ir_rule_group_posreporting0" model="ir.rule.group">
|
|
||||||
<field name="model_id" ref="point_of_sale.model_report_transaction_pos"/>
|
<field name="model_id" ref="point_of_sale.model_report_transaction_pos"/>
|
||||||
<field eval=""""POS Reporting"""" name="name"/>
|
<field eval=""""POS Reporting"""" name="name"/>
|
||||||
<field eval="1" name="global"/>
|
<field name="global" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="ir_rule_5" model="ir.rule">
|
<record id="ir_rule_5" model="ir.rule">
|
||||||
<field eval=""""="""" name="operator"/>
|
<field name="model_id" ref="point_of_sale.model_report_transaction_pos"/>
|
||||||
<field eval=""""user.id"""" name="operand"/>
|
<field name="domain_force">['|',('user_id','=',False),('user_id','=',[user.id])]</field>
|
||||||
<field name="field_id" ref="point_of_sale.field_report_transaction_pos_user_id"/>
|
|
||||||
<field name="rule_group" ref="ir_rule_group_posreporting0"/>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
<field eval="1" name="perm_create"/>
|
<field eval="1" name="perm_create"/>
|
||||||
<field name="group_id" ref="point_of_sale.res_groups_posuser0"/>
|
<field name="group_id" ref="point_of_sale.res_groups_posuser0"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="ir_rule_group_bankstatementcompany0" model="ir.rule.group">
|
<record id="ir_rule_group_bankstatementcompany0" model="ir.rule">
|
||||||
<field name="model_id" ref="account.model_account_bank_statement"/>
|
<field name="model_id" ref="account.model_account_bank_statement"/>
|
||||||
<field eval=""""Bank Statement company"""" name="name"/>
|
<field eval=""""Bank Statement company"""" name="name"/>
|
||||||
<field eval="1" name="global"/>
|
<field eval="1" name="global"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="ir_rule_group_bankstatementlinecompany0" model="ir.rule.group">
|
<record id="ir_rule_group_bankstatementlinecompany0" model="ir.rule">
|
||||||
<field name="model_id" ref="account.model_account_bank_statement_line"/>
|
<field name="model_id" ref="account.model_account_bank_statement_line"/>
|
||||||
<field eval=""""Bank Statement line Company"""" name="name"/>
|
<field eval=""""Bank Statement line Company"""" name="name"/>
|
||||||
<field eval="1" name="global"/>
|
<field eval="1" name="global"/>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" ?>
|
|
||||||
<openerp>
|
|
||||||
<data>
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
|
@ -61,12 +61,6 @@ class pos_open_statement(osv.osv_memory):
|
||||||
number = sequence_obj.get(cr, uid,
|
number = sequence_obj.get(cr, uid,
|
||||||
'account.bank.statement')
|
'account.bank.statement')
|
||||||
|
|
||||||
# statement_id=statement_obj.create(cr,uid,{'journal_id':journal.id,
|
|
||||||
# 'company_id':company_id,
|
|
||||||
# 'user_id':uid,
|
|
||||||
# 'state':'open',
|
|
||||||
# 'name':number
|
|
||||||
# })
|
|
||||||
period = statement_obj._get_period(cr, uid, context) or None
|
period = statement_obj._get_period(cr, uid, context) or None
|
||||||
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id, company_id, uid, number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
|
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id, company_id, uid, number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
"update_xml" : ["wizard/purchase_requisition_partner_view.xml",
|
"update_xml" : ["wizard/purchase_requisition_partner_view.xml",
|
||||||
"purchase_requisition_view.xml",
|
"purchase_requisition_view.xml",
|
||||||
"security/ir.model.access.csv","purchase_requisition_sequence.xml"],
|
"security/ir.model.access.csv","purchase_requisition_sequence.xml"],
|
||||||
# "test":['test/purchase_requisition_test.yml',
|
|
||||||
# 'test/purchase_requisition_exclusive_test.yml'],
|
|
||||||
"active": False,
|
"active": False,
|
||||||
"installable": True
|
"installable": True
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
-
|
|
||||||
In order to test the purchase requicisition 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.
|
|
||||||
-
|
|
||||||
Creating an product.product record
|
|
||||||
-
|
|
||||||
!record {model: product.product, id: product_product_laptopacer0}:
|
|
||||||
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
|
|
||||||
-
|
|
||||||
Creating an sale.order record
|
|
||||||
-
|
|
||||||
!record {model: sale.order, id: sale_order_testtender0}:
|
|
||||||
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_laptopacer0
|
|
||||||
'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
|
|
||||||
-
|
|
||||||
Performing a workflow action order_confirm on module sale.order
|
|
||||||
-
|
|
||||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender0}
|
|
||||||
-
|
|
||||||
I launch he scheduler to compute all procurements, and planify all requisitions order
|
|
||||||
-
|
|
||||||
!python {model: mrp.procurement.compute.all}: |
|
|
||||||
proc_obj = self.pool.get('mrp.procurement')
|
|
||||||
proc_obj._procure_confirm(cr,uid)
|
|
||||||
|
|
||||||
-
|
|
||||||
Creating an purchase.requisition record
|
|
||||||
-
|
|
||||||
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_1}:
|
|
||||||
partner_id: base.res_partner_4
|
|
||||||
partner_address_id: base.res_partner_address_7
|
|
||||||
-
|
|
||||||
!python {model: purchase.requisition}: |
|
|
||||||
requisition_obj = self.pool.get('purchase.requisition.partner')
|
|
||||||
req_obj = self.pool.get('purchase.requisition')
|
|
||||||
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
|
|
||||||
requisition_obj.create_order(cr,uid, [ref('purchase_requisition_partner_1')],{'active_ids': ids})
|
|
||||||
-
|
|
||||||
!python {model: purchase.requisition}: |
|
|
||||||
purchase_obj = self.pool.get('purchase.order')
|
|
||||||
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])[0]
|
|
||||||
self.write(cr,uid,ids,{'exclusive': 'exclusive' })
|
|
||||||
ids =purchase_obj.search(cr, uid, [('requisition_id','in',[ids])])
|
|
||||||
assert (len(ids)<2),"Purchase Order hasn't Created"
|
|
||||||
-
|
|
||||||
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}: |
|
|
||||||
purchase_id= self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
|
|
||||||
order_line=self.browse(cr, uid, purchase_id, context)[0].order_line[0].id
|
|
||||||
self.pool.get('purchase.order.line').write(cr, uid, [order_line], {'product_qty':5})
|
|
||||||
import netsvc
|
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
if purchase_id:
|
|
||||||
wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_confirm', cr)
|
|
||||||
wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_approve', cr)
|
|
||||||
-
|
|
|
@ -1,117 +0,0 @@
|
||||||
-
|
|
||||||
In order to test the purchase requicisition 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.
|
|
||||||
-
|
|
||||||
Creating an product.product record
|
|
||||||
-
|
|
||||||
!record {model: product.product, id: product_product_laptopacer0}:
|
|
||||||
categ_id: product.product_category_3
|
|
||||||
cost_method: standard
|
|
||||||
list_price: 1000.0
|
|
||||||
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
|
|
||||||
-
|
|
||||||
Creating an sale.order record
|
|
||||||
-
|
|
||||||
!record {model: sale.order, id: sale_order_so0}:
|
|
||||||
date_order: '2010-04-20'
|
|
||||||
invoice_quantity: order
|
|
||||||
name: TEST/TENDER/0001
|
|
||||||
order_line:
|
|
||||||
- name: Laptop ACER
|
|
||||||
price_unit: 1000.0
|
|
||||||
product_uom: product.product_uom_unit
|
|
||||||
product_uom_qty: 5.0
|
|
||||||
state: draft
|
|
||||||
'delay': 7.0
|
|
||||||
'product_id': product_product_laptopacer0
|
|
||||||
'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
|
|
||||||
-
|
|
||||||
Performing a workflow action order_confirm on module sale.order
|
|
||||||
-
|
|
||||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
|
||||||
-
|
|
||||||
I launch he scheduler to compute all procurements, and planify all requisitions order
|
|
||||||
-
|
|
||||||
!python {model: mrp.procurement.compute.all}: |
|
|
||||||
proc_obj = self.pool.get('mrp.procurement')
|
|
||||||
proc_obj._procure_confirm(cr,uid)
|
|
||||||
|
|
||||||
-
|
|
||||||
Creating an purchase.requisition record
|
|
||||||
-
|
|
||||||
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}:
|
|
||||||
partner_id: base.res_partner_4
|
|
||||||
partner_address_id: base.res_partner_address_7
|
|
||||||
-
|
|
||||||
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
|
|
||||||
-
|
|
||||||
!python {model: purchase.requisition}: |
|
|
||||||
requisition_obj = self.pool.get('purchase.requisition.partner')
|
|
||||||
req_obj = self.pool.get('purchase.requisition')
|
|
||||||
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
|
|
||||||
requisition_obj.create_order(cr,uid, [ref('purchase_requisition_partner_0')],{'active_ids': ids})
|
|
||||||
-
|
|
||||||
check that I have two purchase orders on the purchase tender
|
|
||||||
-
|
|
||||||
!python {model: purchase.requisition}: |
|
|
||||||
purchase_obj = self.pool.get('purchase.order')
|
|
||||||
requisition_ids= self.search(cr, uid, [],context)
|
|
||||||
ids =purchase_obj.search(cr, uid, [('requisition_id','in',requisition_ids)])
|
|
||||||
assert len(ids) < 2,"Purchase Order hasn't Created"
|
|
||||||
-
|
|
||||||
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}: |
|
|
||||||
purchase_id1= self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
|
|
||||||
purchase_id2= self.search(cr, uid, [('origin','=','TE00001')])
|
|
||||||
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
|
|
||||||
self.pool.get('purchase.order.line').write(cr, uid, [order_line1], {'product_qty':2})
|
|
||||||
self.pool.get('purchase.order.line').write(cr, uid, [order_line2], {'product_qty':3})
|
|
||||||
todo=[]
|
|
||||||
todo.append(purchase_id1[0])
|
|
||||||
todo.append(purchase_id2[0])
|
|
||||||
import netsvc
|
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for ids in todo:
|
|
||||||
wf_service.trg_validate(uid, 'purchase.order',ids,'purchase_confirm', cr)
|
|
||||||
wf_service.trg_validate(uid, 'purchase.order',ids,'purchase_approve', cr)
|
|
||||||
-
|
|
||||||
Create a record in purchase requisition
|
|
||||||
-
|
|
||||||
!python {model: purchase.requisition}: |
|
|
||||||
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
|
|
||||||
self.tender_done(cr,uid,ids)
|
|
||||||
-
|
|
||||||
I check that the delivery order of the customer is in state 'Waiting Goods'
|
|
||||||
-
|
|
||||||
!python {model: sale.order}: |
|
|
||||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
|
||||||
assert (so.picking_ids[0].state) =='confirmed',"Delivery Order not confirmed"
|
|
||||||
assert (so.picking_ids[0].move_lines[0].state=='waiting')
|
|
||||||
-
|
|
||||||
I receive the order of the supplier Asustek from the Incoming Products menu
|
|
Loading…
Reference in New Issue