From 34936a00cb7978105034886da456f96717492f00 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 12:33:04 +0530 Subject: [PATCH 01/16] [IMP] point_of_sale: Point of Sale Manager could have an access to Journal to configure register. bzr revid: uco@tinyerp.com-20100929070304-un0xeh9qbi6glds9 --- addons/point_of_sale/security/ir.model.access.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv index 206c14172f9..d2bc03fd47f 100644 --- a/addons/point_of_sale/security/ir.model.access.csv +++ b/addons/point_of_sale/security/ir.model.access.csv @@ -7,7 +7,7 @@ "access_pos_payment","pos.payment","model_pos_payment","group_pos_user",1,1,1,1 "access_report_transaction_pos","report.transaction.pos","model_report_transaction_pos","group_pos_manager",1,1,1,1 "access_pos_config_journal_manager","pos.config.journal.manager","model_pos_config_journal","group_pos_manager",1,1,1,1 -"access_account_journal_pos_manager","account.journal pos_manager","account.model_account_journal","group_pos_manager",1,0,0,0 +"access_account_journal_pos_manager","account.journal pos_manager","account.model_account_journal","group_pos_manager",1,1,1,0 "access_account_journal_pos_user","account.journal pos_user","account.model_account_journal","group_pos_user",1,0,0,0 "access_account_move_pos_user","account.move pos_user","account.model_account_move","group_pos_user",1,0,0,0 "access_account_account_pos_user","account.account pos_user","account.model_account_account","group_pos_user",1,0,0,0 From adf171e0e4292a2e1b6728507a35eea5158dcdb3 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 13:10:54 +0530 Subject: [PATCH 02/16] [IMP] mrp: Demo data corrected for BoM. bzr revid: uco@tinyerp.com-20100929074054-rltxe1ns3odyxkze --- addons/mrp/mrp_demo.xml | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml index e303ceb3378..e9c4f9f37b2 100644 --- a/addons/mrp/mrp_demo.xml +++ b/addons/mrp/mrp_demo.xml @@ -232,14 +232,6 @@ phantom - - HDD Seagate - 26 - - 1.0 - normal - - Assembly Basic PC 29 @@ -563,6 +555,14 @@ + + Default BOM for Shelf of 100cm + SHE100 + 129 + + + 1.0 + Assembly Section @@ -591,15 +591,6 @@ - - Default BOM for Shelf of 100cm - SHE100 - 129 - - - 1.0 - - 131 @@ -647,15 +638,6 @@ phantom - - 141 - - - - 1.0 - Rear panel SHE100 - - Assembly Section 143 From 42b5a3d7daed9811485ec964cc127886956f1bb4 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 14:38:53 +0530 Subject: [PATCH 03/16] [IMP] mrp_subproduct: yaml corrected. bzr revid: uco@tinyerp.com-20100929090853-iws5d931rqq73z3j --- addons/mrp_subproduct/test/mrp_subproduct.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_subproduct/test/mrp_subproduct.yml b/addons/mrp_subproduct/test/mrp_subproduct.yml index 520a4e98163..56c62b94d09 100644 --- a/addons/mrp_subproduct/test/mrp_subproduct.yml +++ b/addons/mrp_subproduct/test/mrp_subproduct.yml @@ -164,6 +164,6 @@ I see that stock moves of Wood and Nails including Wooden Table are done now. - !python {model: stock.move}: | - move_ids = self.search(cr, uid, [('product_id','in',[ref("product_product_woodenchair0"),ref("product_product_woodentable0"),ref("product_product_wood0"),ref("product_product_nails0")])]) + move_ids = self.search(cr, uid, [('product_id','in',[ref("product_product_woodentable0"),ref("product_product_wood0"),ref("product_product_nails0")])]) moves = self.browse(cr, uid, move_ids) assert all(move.state == 'done' for move in moves), 'Moves are not done!' From ce6a497937078b7de9b3ff011f9add94370abe2e Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 17:14:58 +0530 Subject: [PATCH 04/16] [IMP] point_of_sale: Removed unused variables and import statements suggested by buildbot. bzr revid: uco@tinyerp.com-20100929114458-h0ahdro50hygo1di --- addons/point_of_sale/pos.py | 45 +++++-------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 0d6ab5f2b33..49e2df2199f 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -25,8 +25,6 @@ from osv import fields, osv from mx import DateTime from tools.translate import _ from decimal import Decimal -import tools -import re import decimal_precision as dp class pos_config_journal(osv.osv): @@ -114,9 +112,6 @@ class pos_order(osv.osv): @return: Dictionary of values """ res = {} - pay_obj = self.pool.get('account.bank.statement') - stat_obj_line = self.pool.get('account.bank.statement.line') - tot =0.0 val=None for order in self.browse(cr, uid, ids): cr.execute("select date_payment from pos_order where id=%d"%(order.id)) @@ -138,8 +133,6 @@ class pos_order(osv.osv): @return: Dictionary of values """ res = {} - pay_obj = self.pool.get('pos.payment') - tot =0.0 val=None for order in self.browse(cr, uid, ids): cr.execute("select date_validation from pos_order where id=%d"%(order.id)) @@ -215,7 +208,6 @@ class pos_order(osv.osv): """ To get Shop for this order" @return: Shop id """ - company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id res = self.pool.get('sale.shop').search(cr, uid, []) if res: return res[0] @@ -242,8 +234,6 @@ class pos_order(osv.osv): """ Changed the Validation state of order @return: State """ - flag=False - res_company = self.pool.get('res.company') res_obj = self.pool.get('res.users') company_disc=self.browse(cr,uid,ids) if not company_disc: @@ -540,7 +530,7 @@ class pos_order(osv.osv): res_obj = self.pool.get('res.company') try: part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None - except Exception, e: + except Exception: raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!')) if part_company: raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!')) @@ -559,12 +549,10 @@ class pos_order(osv.osv): """Create a new payment for the order""" - res_obj = self.pool.get('res.company') statement_obj= self.pool.get('account.bank.statement') statementl_obj = self.pool.get('account.bank.statement.line') prod_obj = self.pool.get('product.product') property_obj=self.pool.get('ir.property') - flag='' curr_c=self.pool.get('res.users').browse(cr, uid, uid).company_id curr_company=curr_c.id order = self.browse(cr, uid, order_id, context) @@ -600,7 +588,7 @@ class pos_order(osv.osv): args['statement_id']= statement_id args['pos_statement_id']= order_id args['journal_id']= data['journal'] - statement_line_id = statementl_obj.create(cr, uid, args) + statementl_obj.create(cr, uid, args) ids_new.append(statement_id) wf_service = netsvc.LocalService("workflow") @@ -661,14 +649,12 @@ class pos_order(osv.osv): def action_invoice(self, cr, uid, ids, context=None): """Create a invoice of order """ - res_obj = self.pool.get('res.company') inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') product_obj= self.pool.get('product.product') inv_ids = [] for order in self.pool.get('pos.order').browse(cr, uid, ids, context): - curr_c = order.user_salesman_id.company_id if order.invoice_id: inv_ids.append(order.invoice_id.id) continue @@ -894,21 +880,12 @@ class pos_order(osv.osv): raise osv.except_osv(_('Error !'), _('There is no receivable account defined for this journal:'\ ' "%s" (id:%d)') % (order.sale_journal.name, order.sale_journal.id, )) - am=0.0 for payment in order.statement_ids: - am+=payment.amount - - if am > 0: - payment_account = \ - payment.statement_id.journal_id.default_debit_account_id.id - else: - payment_account = \ - payment.statement_id.journal_id.default_credit_account_id.id # Create one entry for the payment if payment.is_acc: continue - payment_move_id = account_move_obj.create(cr, uid, { + account_move_obj.create(cr, uid, { 'journal_id': payment.statement_id.journal_id.id, 'period_id': period, }, context=context) @@ -1042,9 +1019,8 @@ class pos_order_line(osv.osv): def _amount_line(self, cr, uid, ids, field_name, arg, context): res = {} - prices = self.price_by_product_multi(cr, uid, ids) + self.price_by_product_multi(cr, uid, ids) for line in self.browse(cr, uid, ids): - price = prices[line.id] if line.discount!=0.0: res[line.id] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0) else: @@ -1056,11 +1032,10 @@ class pos_order_line(osv.osv): account_tax_obj = self.pool.get('account.tax') - prices = self.price_by_product_multi(cr, uid, ids) + self.price_by_product_multi(cr, uid, ids) for line in self.browse(cr, uid, ids): for f in field_names: if f == 'price_subtotal': - price = prices[line.id] if line.discount != 0.0: res[line.id][f] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0) else: @@ -1073,7 +1048,6 @@ class pos_order_line(osv.osv): computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit, line.qty)['taxes'] for tax in computed_taxes: tax_amount += tax['amount'] - price = prices[line.id] if line.discount!=0.0: res[line.id][f] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0) else: @@ -1097,8 +1071,6 @@ class pos_order_line(osv.osv): for line in lines: pricelist = line.order_id.pricelist_id.id product_id = line.product_id - qty = line.qty or 0 - partner_id = line.order_id.partner_id.id or False if not product_id: res[line.id] = 0.0 @@ -1108,8 +1080,6 @@ class pos_order_line(osv.osv): _('You have to select a pricelist in the sale form !\n' \ 'Please set one before choosing a product.')) - uom_id = product_id.uom_po_id.id - #old_price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product_id.id, qty or 1.0, partner_id, {'uom': uom_id})[pricelist] #print "prod_id: %s, pricelist: %s, price: %s" % (product_id.id, pricelist, price) price = price_get_multi_res[line.product_id.id][pricelist] @@ -1170,9 +1140,7 @@ class pos_order_line(osv.osv): return {'value': {'price_subtotal_incl':sub_total_discount}} def onchange_ded(self, cr, uid,ids, val_ded,price_u,*a): - pos_order = self.pool.get('pos.order.line') res_obj = self.pool.get('res.users') - res_company = self.pool.get('res.company') comp = res_obj.browse(cr,uid,uid).company_id.company_discount or 0.0 val=0.0 if val_ded and price_u: @@ -1184,7 +1152,6 @@ class pos_order_line(osv.osv): def onchange_discount(self, cr, uid,ids, discount,price,*a): pos_order = self.pool.get('pos.order.line') res_obj = self.pool.get('res.users') - res_company = self.pool.get('res.company') company_disc = pos_order.browse(cr,uid,ids) if discount: if not company_disc: @@ -1282,7 +1249,7 @@ class pos_order_line(osv.osv): } line_id = self.write(cr, uid, order_line_id, vals) if not line_id: - raise wizard.except_wizard(_('Error'), _('Modify line failed !')) + raise osv.except_osv(_('Error'), _('Modify line failed !')) line_id = order_line_id price_line = float(qty)*float(price) From f1abdb085e21cadc207b8aaba29f4e2f0fc253d2 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 17:42:12 +0530 Subject: [PATCH 05/16] [FIX] mrp_operations: Scheduled date error corrected. [REM] point_of_sale: Removed remaining unused variable. bzr revid: uco@tinyerp.com-20100929121212-e14ej6jeq1eyvp88 --- addons/mrp_operations/mrp_operations.py | 4 ++-- addons/point_of_sale/pos.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 919f65903ae..e0c335f4f7c 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -257,7 +257,7 @@ class mrp_production(osv.osv): """ dt_end = DateTime.now() for po in self.browse(cr, uid, ids, context=context): - dt_end = DateTime.strptime(po.date_start or po.date_planned, '%Y-%m-%d %H:%M:%S') + dt_end = DateTime.strptime(po.date_planned, '%Y-%m-%d %H:%M:%S') if not po.date_start: self.write(cr, uid, [po.id], { 'date_start': po.date_planned @@ -271,7 +271,7 @@ class mrp_production(osv.osv): del context['__last_update'] if (wc.date_planned < dt.strftime('%Y-%m-%d %H:%M:%S')) or mini: self.pool.get('mrp.production.workcenter.line').write(cr, uid, [wc.id], { - 'date_planned':dt.strftime('%Y-%m-%d %H:%M:%S') + 'date_planned': dt.strftime('%Y-%m-%d %H:%M:%S') }, context=context, update=False) i = self.pool.get('resource.calendar').interval_get( cr, diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 49e2df2199f..80363f719fd 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -999,7 +999,7 @@ class pos_order_line(osv.osv): def _amount_line_ttc(self, cr, uid, ids, field_name, arg, context): res = dict.fromkeys(ids, 0.0) account_tax_obj = self.pool.get('account.tax') - prices = self.price_by_product_multi(cr, uid, ids) + self.price_by_product_multi(cr, uid, ids) for line in self.browse(cr, uid, ids): tax_amount = 0.0 taxes = [t for t in line.product_id.taxes_id] @@ -1008,7 +1008,6 @@ class pos_order_line(osv.osv): computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit, line.qty)['taxes'] for tax in computed_taxes: tax_amount += tax['amount'] - price = prices[line.id] if line.discount!=0.0: res[line.id] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0) else: From 4ed55f32661934c7a85941811352ef4ae05dc42f Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 29 Sep 2010 18:03:12 +0530 Subject: [PATCH 06/16] [IMP] point_of_sale: Yaml corrected. bzr revid: uco@tinyerp.com-20100929123312-relagkx8cnjn02tf --- addons/point_of_sale/test/pos_report.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/test/pos_report.yml b/addons/point_of_sale/test/pos_report.yml index d17e487794e..08052356104 100644 --- a/addons/point_of_sale/test/pos_report.yml +++ b/addons/point_of_sale/test/pos_report.yml @@ -67,6 +67,15 @@ (data, format) = netsvc.LocalService('report.pos.details').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d') }}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos details report'+format), 'wb+').write(data) +- + I create a cash journal. +- + !record {model: account.journal, id: account_journal_cash0}: + name: 'Cash Journal' + code: 'CSJ' + type: 'cash' + view_id: account.account_journal_bank_view + sequence_id: account.sequence_journal - I create a record for Bank Statement. - @@ -74,7 +83,7 @@ name: St.05/19 balance_end_real: 0.0 date: '2010-05-19' - journal_id: account.bank_journal + journal_id: account_journal_cash0 period_id: account.period_5 state: 'draft' - From af4eddb20933747bcc7998ffc1a2ca07db9bbd51 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Fri, 1 Oct 2010 11:51:17 +0530 Subject: [PATCH 07/16] [FIX] mrp, mrp_operations: Fixed Workcenter report error. Removed variable suggested by buildbot. bzr revid: uco@tinyerp.com-20101001062117-jciimkl89o8pgp1b --- addons/mrp/report/workcenter_load.py | 27 ++++++++++++++----------- addons/mrp_operations/mrp_operations.py | 1 - 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/mrp/report/workcenter_load.py b/addons/mrp/report/workcenter_load.py index 15e94bd6f4c..922e460ab6d 100644 --- a/addons/mrp/report/workcenter_load.py +++ b/addons/mrp/report/workcenter_load.py @@ -22,9 +22,8 @@ from report.render import render from report.interface import report_int from pychart import * -from mx.DateTime import * import time -from datetime import datetime +from datetime import date, datetime, timedelta from dateutil.relativedelta import relativedelta from report.misc import choice_colors @@ -55,8 +54,8 @@ class report_custom(report_int): stop = start if time_unit == 'month': dates = {} - a = Date(*map(int, start.split("-"))).year*12+Date(*map(int, start.split("-"))).month - z = Date(*map(int, stop.split("-"))).year*12+Date(*map(int, stop.split("-"))).month+1 + a = int(start.split("-")[0])*12 + int(start.split("-")[1]) + z = int(stop.split("-")[0])*12 + int(stop.split("-")[1]) + 1 for i in range(a,z): year = i/12 month = i%12 @@ -66,27 +65,31 @@ class report_custom(report_int): months = {1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"} dates[i] = { 'name' :months[month], - 'start':(datetime.date(year, month, 2) + relativedelta(day=1)).strftime('%Y-%m-%d'), - 'stop' :(datetime.date(year, month, 2) + relativedelta(day=-1)).strftime('%Y-%m-%d'), + 'start':(datetime(year, month, 2) + relativedelta(day=1)).strftime('%Y-%m-%d'), + 'stop' :(datetime(year, month, 2) + relativedelta(day=31)).strftime('%Y-%m-%d'), } return dates elif time_unit == 'week': dates = {} - a = Date(*map(int, start.split("-"))).iso_week[0]*52+Date(*map(int, start.split("-"))).iso_week[1] - z = Date(*map(int, stop.split("-"))).iso_week[0]*52+Date(*map(int, stop.split("-"))).iso_week[1] + start_week = date(int(start.split("-")[0]),int(start.split("-")[1]),int(start.split("-")[2])).isocalendar() + end_week = date(int(stop.split("-")[0]),int(stop.split("-")[1]),int(stop.split("-")[2])).isocalendar() + a = int(start.split("-")[0])*52 + start_week[1] + z = int(stop.split("-")[0])*52 + end_week[1] for i in range(a,z+1): year = i/52 week = i%52 + d = date(year, 1, 1) + dates[i] = { 'name' :"Week #%d" % week, - 'start':ISO.WeekTime(year, week, 1).strftime('%Y-%m-%d'), - 'stop' :ISO.WeekTime(year, week, 7).strftime('%Y-%m-%d'), + 'start':(d + timedelta(days=-d.weekday(), weeks=week)).strftime('%Y-%m-%d'), + 'stop' :(d + timedelta(days=6-d.weekday(), weeks=week)).strftime('%Y-%m-%d'), } return dates else: # time_unit = day dates = {} - a = Date(*map(int, start.split("-"))) - z = Date(*map(int, stop.split("-"))) + a = datetime(int(start.split("-")[0]),int(start.split("-")[1]),int(start.split("-")[2])) + z = datetime(int(stop.split("-")[0]),int(stop.split("-")[1]),int(stop.split("-")[2])) i = a while i <= z: dates[map(int,i.strftime('%Y%m%d').split())[0]] = { diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 8952d96c5c7..4ab3bf90956 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -75,7 +75,6 @@ class mrp_production_workcenter_line(osv.osv): for op in ops: res[op.id] = False if op.date_planned: - d = DateTime.strptime(op.date_planned,'%Y-%m-%d %H:%M:%S') i = intervals[(op.date_planned, op.hour, op.workcenter_id.calendar_id.id)] if i: res[op.id] = i[-1][1].strftime('%Y-%m-%d %H:%M:%S') From 119803c7cf6455e2a54eace11ae0ce56dc021419 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Fri, 1 Oct 2010 14:24:24 +0530 Subject: [PATCH 08/16] [IMP] point_of_sale: Make Payment wizard view improved. bzr revid: uco@tinyerp.com-20101001085424-1zxe32iskx6aosj0 --- addons/point_of_sale/wizard/pos_payment.xml | 60 +++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/addons/point_of_sale/wizard/pos_payment.xml b/addons/point_of_sale/wizard/pos_payment.xml index 36c92664e0b..58b4dc447cd 100644 --- a/addons/point_of_sale/wizard/pos_payment.xml +++ b/addons/point_of_sale/wizard/pos_payment.xml @@ -1,9 +1,7 @@ - - -""" + @@ -12,30 +10,38 @@ form
- - - - - - - - - - - - - - - - - - - -