diff --git a/addons/point_of_sale/__init__.py b/addons/point_of_sale/__init__.py index ddd7dc3c01f..8b041be5801 100644 --- a/addons/point_of_sale/__init__.py +++ b/addons/point_of_sale/__init__.py @@ -20,9 +20,8 @@ # ############################################################################## -import pos import account_bank_statement -import pos_account_bank_statement +import pos import stock import wizard import report diff --git a/addons/point_of_sale/account_bank_statement.py b/addons/point_of_sale/account_bank_statement.py index 57276219861..f1ce05dada0 100644 --- a/addons/point_of_sale/account_bank_statement.py +++ b/addons/point_of_sale/account_bank_statement.py @@ -132,8 +132,6 @@ class account_bank_statement(osv.osv): _columns = { '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.float('Starting Balance',digits=(16,2)), - # 'balance_end': fields.float('Balance',digits=(16,2)), 'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirm'),('open','Open')], '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"), @@ -142,6 +140,8 @@ class account_bank_statement(osv.osv): 'starting_details_ids': fields.one2many('singer.statement', 'starting_id', string='Starting Details'), 'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Ending Details'), '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 = { @@ -149,7 +149,8 @@ class account_bank_statement(osv.osv): 'name': lambda *a: '/', 'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"), '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): @@ -210,12 +211,13 @@ class account_bank_statement(osv.osv): @return: True """ obj_inv = self.browse(cr, uid, ids)[0] + sequence_obj=self.pool.get('ir.sequence') s_id=obj_inv.journal_id if s_id.statement_sequence_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: - number = self.pool.get('ir.sequence').get(cr, uid, + number = sequence_obj.get(cr, uid, 'account.bank.statement') 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)))))) 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) 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() - diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 7c872bda845..a59ae6e9d5b 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -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)) res=cr.fetchone() 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]) if line.qty < 0: location_id, stock_dest_id = stock_dest_id, location_id @@ -1015,18 +1014,9 @@ class pos_order(osv.osv): 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): _inherit = 'account.bank.statement.line' + def _get_statement_journal(self, cr, uid, ids, context, *a): res = {} 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"), 'is_acc':fields.boolean("Is accompte"), '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() class pos_order_line(osv.osv): diff --git a/addons/point_of_sale/pos_account_bank_statement.py b/addons/point_of_sale/pos_account_bank_statement.py deleted file mode 100644 index 60924350014..00000000000 --- a/addons/point_of_sale/pos_account_bank_statement.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). 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 . -# -############################################################################## - -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: diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml index e9829addbda..f32c23b92ff 100644 --- a/addons/point_of_sale/pos_view.xml +++ b/addons/point_of_sale/pos_view.xml @@ -175,7 +175,9 @@ - + + + diff --git a/addons/point_of_sale/posrule_data.xml b/addons/point_of_sale/posrule_data.xml index b85fe0b8e4c..69dcf769700 100644 --- a/addons/point_of_sale/posrule_data.xml +++ b/addons/point_of_sale/posrule_data.xml @@ -25,23 +25,18 @@ - - - - - - - - - + POS line + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - + @@ -66,42 +61,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + - + - - - - + + ['|',('user_id','=',False),('user_id','=',[user.id])] diff --git a/addons/point_of_sale/statement_data.xml b/addons/point_of_sale/statement_data.xml index 947348a990d..098f4cb2b00 100644 --- a/addons/point_of_sale/statement_data.xml +++ b/addons/point_of_sale/statement_data.xml @@ -21,13 +21,13 @@ - + - + diff --git a/addons/point_of_sale/statement_rules.xml b/addons/point_of_sale/statement_rules.xml deleted file mode 100644 index eba649f3ec5..00000000000 --- a/addons/point_of_sale/statement_rules.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 6605f3e46e8..d30b3c0a898 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -61,12 +61,6 @@ class pos_open_statement(osv.osv_memory): number = sequence_obj.get(cr, uid, '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 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() diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index b5cdc9723c4..35e7e8a82ca 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -34,8 +34,6 @@ "update_xml" : ["wizard/purchase_requisition_partner_view.xml", "purchase_requisition_view.xml", "security/ir.model.access.csv","purchase_requisition_sequence.xml"], -# "test":['test/purchase_requisition_test.yml', -# 'test/purchase_requisition_exclusive_test.yml'], "active": False, "installable": True } diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive_test.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive_test.yml deleted file mode 100644 index 55b7cd44640..00000000000 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive_test.yml +++ /dev/null @@ -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) -- \ No newline at end of file diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml deleted file mode 100644 index de4af5c9b6b..00000000000 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ /dev/null @@ -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