From c762b165371e99880bf46e624b4f928772cfe724 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 20 May 2011 11:42:28 +0530 Subject: [PATCH 001/190] [FIX]purchase:Purchase Order report does not print destination address ,fixed =>if destination address not there then address will be getting from default wharhouse address lp bug: https://launchpad.net/bugs/784265 fixed bzr revid: ron@tinyerp.com-20110520061228-poi0uddsdbk0klcp --- addons/purchase/report/order.rml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 4b143d0f961..18e53aade77 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -165,21 +165,13 @@ - - - - - - - - [[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]] Shipping address : - [[ (addr.partner_id and addr.partner_id.title and addr.partner_id.title.name) or '' ]] [[ (addr.partner_id and addr.partner_id.name) or '' ]] - [[ addr.street ]] - [[ addr.street2 or removeParentNode('para') ]] - [[ addr.zip or '' ]] [[ addr.city or '' ]] - [[ addr.state_id and addr.state_id.name or removeParentNode('para') ]] - [[ addr.country_id and addr.country_id.name or '' ]] + [[ (o.dest_address_id and o.dest_address_id.partner_id.name) or (o.warehouse_id and o.warehouse_id.name) or '']] + [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.street) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.street) or '']] + [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.street2) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.street2) or removeParentNode('para') ]] + [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.zip) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.zip) or '' ]] [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.city) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.city) or '' ]] + [[ (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.state_id and o.warehouse_id.partner_address_id.state_id.name) or o.partner_address_id and o.partner_address_id.state_id and o.partner_address_id.state_id.name or removeParentNode('para') ]] + [[ (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.country_id and o.warehouse_id.partner_address_id.country_id.name) or o.partner_address_id.country_id.name ]] From 0bb1e1cba0343d995ea1b98692200534f7a620e9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 24 May 2011 17:49:58 +0530 Subject: [PATCH 002/190] [FIX]mrp:extensibility broken in action_scrap lp bug: https://launchpad.net/bugs/780589 fixed bzr revid: ron@tinyerp.com-20110524121958-t1vu2wpnk2yimgo2 --- addons/mrp/stock.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py index 0c1454edf98..29994398f06 100644 --- a/addons/mrp/stock.py +++ b/addons/mrp/stock.py @@ -137,14 +137,13 @@ class StockMove(osv.osv): wf_service = netsvc.LocalService("workflow") for move in self.browse(cr, uid, ids, context=context): new_moves = super(StockMove, self).action_scrap(cr, uid, [move.id], product_qty, location_id, context=context) - self.write(cr, uid, [move.id], {'prodlot_id': False, 'tracking_id': False}) production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])]) for prod_id in production_ids: wf_service.trg_validate(uid, 'mrp.production', prod_id, 'button_produce', cr) for new_move in new_moves: production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]}) res.append(new_move) - return {} + return res StockMove() From c6c0ca1207ba38e8fa5ea6b3fa61a5c9932eb156 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 3 Jun 2011 11:18:49 +0530 Subject: [PATCH 003/190] [IMP]purchase:Fixed=>Give proper state and country value in Purchase Order report bzr revid: ron@tinyerp.com-20110603054849-60kvwno0a27eai3l --- addons/purchase/report/order.rml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 18e53aade77..5e0aa082fa2 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -170,8 +170,8 @@ [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.street) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.street) or '']] [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.street2) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.street2) or removeParentNode('para') ]] [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.zip) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.zip) or '' ]] [[ (o.dest_address_id and o.dest_address_id and o.dest_address_id.city) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.city) or '' ]] - [[ (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.state_id and o.warehouse_id.partner_address_id.state_id.name) or o.partner_address_id and o.partner_address_id.state_id and o.partner_address_id.state_id.name or removeParentNode('para') ]] - [[ (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.country_id and o.warehouse_id.partner_address_id.country_id.name) or o.partner_address_id.country_id.name ]] + [[ (o.dest_address_id and o.dest_address_id.state_id and o.dest_address_id.state_id.name) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.state_id and o.warehouse_id.partner_address_id.state_id.name) or removeParentNode('para') ]] + [[ (o.dest_address_id and o.dest_address_id.country_id and o.dest_address_id.country_id.name) or (o.warehouse_id and o.warehouse_id.partner_address_id and o.warehouse_id.partner_address_id.country_id and o.warehouse_id.partner_address_id.country_id.name) ]] From 87aa4380d4008db1d0058cdd08c9d2989edabaa4 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 3 Jun 2011 12:29:38 +0530 Subject: [PATCH 004/190] [IMP]mrp: instead of removing the line give the proper comment of that line bzr revid: ron@tinyerp.com-20110603065938-chm15leo6r9aazil --- addons/mrp/stock.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py index 29994398f06..2756e383adb 100644 --- a/addons/mrp/stock.py +++ b/addons/mrp/stock.py @@ -137,6 +137,8 @@ class StockMove(osv.osv): wf_service = netsvc.LocalService("workflow") for move in self.browse(cr, uid, ids, context=context): new_moves = super(StockMove, self).action_scrap(cr, uid, [move.id], product_qty, location_id, context=context) + #If we are not scrapping our whole move, tracking and lot references must not be removed + #self.write(cr, uid, [move.id], {'prodlot_id': False, 'tracking_id': False}) production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])]) for prod_id in production_ids: wf_service.trg_validate(uid, 'mrp.production', prod_id, 'button_produce', cr) From c83acd9ce4e04cadac352fa25db4e42c2a235f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= <> Date: Wed, 15 Jun 2011 15:34:11 +0530 Subject: [PATCH 005/190] [ADD] hr : Added default value for departmet and applied onchange method for department according to employee_id lp bug: https://launchpad.net/bugs/708730 fixed bzr revid: bde@tiny2-desktop-20110615100411-gs5vkug3kb0i8sg8 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 15 ++++++++++++++- .../hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index ea2b5017790..94b390b30a2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -321,9 +321,15 @@ class hr_timesheet_sheet(osv.osv): return time.strftime('%Y-12-31') return time.strftime('%Y-%m-%d') - def _default_employee(self,cr, uid, context=None): + def _default_employee(self, cr, uid, context=None): emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context) return emp_ids and emp_ids[0] or False + + def _default_department(self, cr, uid, context=None): + emp_id = self._default_employee(cr, uid, context) + if emp_id: + return self.pool.get('hr.employee').read(cr, uid, [emp_id], context)[0]['department_id'] + return False _defaults = { 'date_from' : _default_date_from, @@ -331,6 +337,7 @@ class hr_timesheet_sheet(osv.osv): 'date_to' : _default_date_to, 'state': 'new', 'employee_id': _default_employee, + 'department_id': _default_department, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c) } @@ -382,6 +389,12 @@ class hr_timesheet_sheet(osv.osv): raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which have attendance entries encoded !')) return super(hr_timesheet_sheet, self).unlink(cr, uid, ids, context=context) + def onchange_department_id(self, cr, uid, ids, employee_id, context=None): + department_id = False + if employee_id: + department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id or False + return {'value': {'department_id': department_id}} + hr_timesheet_sheet() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 321e4c2addd..dc43ca10920 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -66,7 +66,7 @@ - + From 6e948ccb54036e70c49f51df48dee8dd4a3de674 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Wed, 15 Jun 2011 16:29:40 +0530 Subject: [PATCH 006/190] [FIX] product:Now user can create unique UOM lp bug: https://launchpad.net/bugs/731035 fixed bzr revid: aag@tinyerp.co.in-20110615105940-ke84jj7rrgtpv02v --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index fa6796b3953..1db24e1bd32 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -122,7 +122,7 @@ class product_uom(osv.osv): _sql_constraints = [ ('factor_gt_zero', 'CHECK (factor!=0)', 'The conversion ratio for a unit of measure cannot be 0!'), - ('factor_category_id_uniq', 'unique (category_id, factor)', 'You can not have more than one UOM with same factor for same UOM category'), + ('uom_name_unique', 'unique (name)', 'You cannot have multiple Units of Measure with the same name'), ] def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False): From 3cc05ec6f96af8a9f3d464d0ddf3c2bf8177bf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= <> Date: Wed, 15 Jun 2011 18:43:26 +0530 Subject: [PATCH 007/190] [FIX] hr_expense: Fixed problem of company id when creating invoice from expenses. lp bug: https://launchpad.net/bugs/796363 fixed bzr revid: uco@tinyerp.com-20110615131326-64npowgjwy4jk4xy --- addons/hr_expense/hr_expense.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 2e7020306b5..07e3ef94063 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -24,6 +24,7 @@ import time from osv import fields, osv from tools.translate import _ import decimal_precision as dp +import netsvc def _employee_get(obj, cr, uid, context=None): if context is None: @@ -54,6 +55,12 @@ class hr_expense_expense(osv.osv): else: return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)], context=context)[0] + def _company_get(obj, cr, uid, context=None): + employee_id = _employee_get(obj, cr, uid, context) + if employee_id: + return obj.pool.get('hr.employee').read(cr, uid, [employee_id], ['company_id'], context)[0]['company_id'] + return False + _name = "hr.expense.expense" _description = "Expense" _columns = { @@ -91,14 +98,18 @@ class hr_expense_expense(osv.osv): 'employee_id': _employee_get, 'user_id': lambda cr, uid, id, c={}: id, 'currency_id': _get_currency, - 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, + 'company_id': _company_get, } def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): + emp_obj = self.pool.get('hr.employee') department_id = False + company_id = False if employee_id: - department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id or False - return {'value':{'department_id':department_id}} + employee = emp_obj.browse(cr, uid, employee_id, context=context) + department_id = employee.department_id.id or False + company_id = employee.company_id.id or False + return {'value':{'department_id':department_id, 'company_id':company_id}} def expense_confirm(self, cr, uid, ids, *args): self.write(cr, uid, ids, { @@ -153,6 +164,7 @@ class hr_expense_expense(osv.osv): analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): + company_id = exp.company_id.id lines = [] for l in exp.line_ids: tax_id = [] @@ -162,10 +174,9 @@ class hr_expense_expense(osv.osv): acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: - acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') + acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context={'force_company': company_id}) if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expense account for Product purchase, `property_account_expense_categ`')) - lines.append((0, False, { 'name': l.name, 'account_id': acc.id, @@ -190,6 +201,7 @@ class hr_expense_expense(osv.osv): 'partner_id': exp.employee_id.address_home_id.partner_id.id, 'address_invoice_id': exp.employee_id.address_home_id.id, 'address_contact_id': exp.employee_id.address_home_id.id, + 'company_id': company_id, 'origin': exp.name, 'invoice_line': lines, 'currency_id': exp.currency_id.id, @@ -205,7 +217,7 @@ class hr_expense_expense(osv.osv): inv['journal_id']=exp.journal_id.id journal = exp.journal_id else: - journal_id = invoice_obj._get_journal(cr, uid, context={'type': 'in_invoice'}) + journal_id = invoice_obj._get_journal(cr, uid, context={'type': 'in_invoice', 'company_id': company_id}) if journal_id: inv['journal_id'] = journal_id journal = account_journal.browse(cr, uid, journal_id) @@ -248,7 +260,7 @@ class hr_expense_line(osv.osv): 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Account')), 'unit_quantity': fields.float('Quantities' ), 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), - 'uom_id': fields.many2one('product.uom', 'UoM' ), + 'uom_id': fields.many2one('product.uom', 'UoM'), 'description': fields.text('Description'), 'analytic_account': fields.many2one('account.analytic.account','Analytic account'), 'ref': fields.char('Reference', size=32), From 8f34b9bc5f0f9c8b2f876548573b775aeaccee49 Mon Sep 17 00:00:00 2001 From: bde Date: Thu, 16 Jun 2011 18:33:31 +0530 Subject: [PATCH 008/190] [REM] hr : Removed default method, improved the code in onchange method and renamed the onchange method bzr revid: bde@tiny2-desktop-20110616130331-akwurvfky183f442 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 16 ++++++---------- .../hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 94b390b30a2..02ba6d6dd68 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -325,19 +325,12 @@ class hr_timesheet_sheet(osv.osv): emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context) return emp_ids and emp_ids[0] or False - def _default_department(self, cr, uid, context=None): - emp_id = self._default_employee(cr, uid, context) - if emp_id: - return self.pool.get('hr.employee').read(cr, uid, [emp_id], context)[0]['department_id'] - return False - _defaults = { 'date_from' : _default_date_from, 'date_current' : lambda *a: time.strftime('%Y-%m-%d'), 'date_to' : _default_date_to, 'state': 'new', 'employee_id': _default_employee, - 'department_id': _default_department, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c) } @@ -389,11 +382,14 @@ class hr_timesheet_sheet(osv.osv): raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which have attendance entries encoded !')) return super(hr_timesheet_sheet, self).unlink(cr, uid, ids, context=context) - def onchange_department_id(self, cr, uid, ids, employee_id, context=None): - department_id = False + def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): + res = {'value':{}} if employee_id: department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id or False - return {'value': {'department_id': department_id}} + res['value'] = { + 'department_id': department_id, + } + return res hr_timesheet_sheet() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index dc43ca10920..bbcebaec9d3 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -66,7 +66,7 @@ - + From dee848cb217e73e330227c2612e6f35b41867c0c Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 17 Jun 2011 10:45:01 +0530 Subject: [PATCH 009/190] [FIX] hr_expense: Used browse instead of read method for _company_get. bzr revid: uco@tinyerp.com-20110617051501-o9cx1faew9v7qv6y --- addons/hr_expense/hr_expense.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 07e3ef94063..8dcfcd6c2db 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -58,7 +58,7 @@ class hr_expense_expense(osv.osv): def _company_get(obj, cr, uid, context=None): employee_id = _employee_get(obj, cr, uid, context) if employee_id: - return obj.pool.get('hr.employee').read(cr, uid, [employee_id], ['company_id'], context)[0]['company_id'] + return obj.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).company_id.id return False _name = "hr.expense.expense" From e5712ece72e688c30f8fce018ae7753b08474ace Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 17 Jun 2011 15:25:08 +0530 Subject: [PATCH 010/190] [FIX] hr_expense: Removed default value for company id. bzr revid: uco@tinyerp.com-20110617095508-qqv2bdr2h1rfs2g6 --- addons/hr_expense/hr_expense.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 8dcfcd6c2db..60e05b9e9dd 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -55,12 +55,6 @@ class hr_expense_expense(osv.osv): else: return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)], context=context)[0] - def _company_get(obj, cr, uid, context=None): - employee_id = _employee_get(obj, cr, uid, context) - if employee_id: - return obj.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).company_id.id - return False - _name = "hr.expense.expense" _description = "Expense" _columns = { @@ -98,7 +92,6 @@ class hr_expense_expense(osv.osv): 'employee_id': _employee_get, 'user_id': lambda cr, uid, id, c={}: id, 'currency_id': _get_currency, - 'company_id': _company_get, } def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): From b113f671595c426b14b2f6ea3e9e25187a31d6ab Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 17 Jun 2011 15:30:09 +0530 Subject: [PATCH 011/190] [REF] hr_expense: Small Refactoring. bzr revid: uco@tinyerp.com-20110617100009-m9mkt7nh6fsu0zdn --- addons/hr_expense/hr_expense.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 60e05b9e9dd..f9768b557e1 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -100,9 +100,9 @@ class hr_expense_expense(osv.osv): company_id = False if employee_id: employee = emp_obj.browse(cr, uid, employee_id, context=context) - department_id = employee.department_id.id or False - company_id = employee.company_id.id or False - return {'value':{'department_id':department_id, 'company_id':company_id}} + department_id = employee.department_id.id + company_id = employee.company_id.id + return {'value': {'department_id': department_id, 'company_id': company_id}} def expense_confirm(self, cr, uid, ids, *args): self.write(cr, uid, ids, { From 461c89b180f55d25a0c5e18ae3926207f45a0331 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 17 Jun 2011 18:29:52 +0530 Subject: [PATCH 012/190] [IMP] hr_timesheet_sheet: Improved onchange_employee_id method. bzr revid: uco@tinyerp.com-20110617125952-m1xbspu0j2d81g5e --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 02ba6d6dd68..a8cda50bd0f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -383,13 +383,10 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).unlink(cr, uid, ids, context=context) def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): - res = {'value':{}} + department_id = False if employee_id: - department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id or False - res['value'] = { - 'department_id': department_id, - } - return res + department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id + return {'value': {'department_id': department_id}} hr_timesheet_sheet() From 0890da73530daf8fe3a8e65197f551fb0554a62b Mon Sep 17 00:00:00 2001 From: "mayur maheshwari (Open ERP)" Date: Fri, 17 Jun 2011 18:48:08 +0530 Subject: [PATCH 013/190] [FIX]multi_company,purchase:created a sequence for purchase order and demo data for company shop1 and shop2 lp bug: https://launchpad.net/bugs/787052 fixed bzr revid: mma@tinyerp.com-20110617131808-dx8387t60fzebzv2 --- addons/multi_company/__openerp__.py | 3 +- addons/multi_company/multi_company_demo.xml | 26 ++++++++++++++++ .../multi_company_purchase_sequence.xml | 31 +++++++++++++++++++ addons/purchase/purchase.py | 2 +- 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 addons/multi_company/multi_company_purchase_sequence.xml diff --git a/addons/multi_company/__openerp__.py b/addons/multi_company/__openerp__.py index baf3a88c32e..beeffc75358 100644 --- a/addons/multi_company/__openerp__.py +++ b/addons/multi_company/__openerp__.py @@ -39,7 +39,8 @@ This module is the base module for other multi-company modules. ], 'init_xml': [], 'update_xml': [ - 'res_company_view.xml' + 'res_company_view.xml', + 'multi_company_purchase_sequence.xml', ], 'demo_xml': [ 'multi_company_demo.xml' diff --git a/addons/multi_company/multi_company_demo.xml b/addons/multi_company/multi_company_demo.xml index d3b46e6d112..583f83d252d 100644 --- a/addons/multi_company/multi_company_demo.xml +++ b/addons/multi_company/multi_company_demo.xml @@ -267,6 +267,32 @@ + + + Expenses Journal - (Shop 1) + EXJ-Shop 1 + purchase + + + + + + + + + + + Expenses Journal - (Shop 2) + EXJ-Shop 2 + purchase + + + + + + + + Expenses Credit Notes Journal - (OpenERP IN) diff --git a/addons/multi_company/multi_company_purchase_sequence.xml b/addons/multi_company/multi_company_purchase_sequence.xml new file mode 100644 index 00000000000..8205866e573 --- /dev/null +++ b/addons/multi_company/multi_company_purchase_sequence.xml @@ -0,0 +1,31 @@ + + + + + + + + Purchase Order + purchase.order + + + + + + Purchase Order + purchase.order + PO + 5 + + + + + Purchase Order + purchase.order + PO + 5 + + + + + diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6f6ab0c1b44..436ec0b021b 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -228,7 +228,7 @@ class purchase_order(osv.osv): 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), } _sql_constraints = [ - ('name_uniq', 'unique(name)', 'Order Reference must be unique !'), + ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique !'), ] _name = "purchase.order" _description = "Purchase Order" From 4b6c69f4219c2eeba85a4dc97369a0f34448396b Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Tue, 21 Jun 2011 18:03:55 +0530 Subject: [PATCH 014/190] [FIX] product :Remove _sql_constraints lp bug: https://launchpad.net/bugs/731035 fixed bzr revid: aag@tinyerp.co.in-20110621123355-rxwrb82jlckl622w --- addons/product/product.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 1db24e1bd32..a6513522db2 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -122,7 +122,6 @@ class product_uom(osv.osv): _sql_constraints = [ ('factor_gt_zero', 'CHECK (factor!=0)', 'The conversion ratio for a unit of measure cannot be 0!'), - ('uom_name_unique', 'unique (name)', 'You cannot have multiple Units of Measure with the same name'), ] def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False): From 645d0a870d32bec67b1fc3d40d6ece0d52df0d52 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Fri, 1 Jul 2011 17:26:28 +0530 Subject: [PATCH 015/190] [FIX] purchase,sale : one category can have several UoM references than it will not give error msg when open related Report lp bug: https://launchpad.net/bugs/731035 fixed bzr revid: aag@tinyerp.co.in-20110701115628-500ttalfgqlhifnx --- addons/purchase/report/purchase_report.py | 2 +- addons/sale/report/sale_report.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index 6b68cecf1a5..c91920a0d86 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -93,7 +93,7 @@ class purchase_report(osv.osv): l.product_id, t.categ_id as category_id, (case when u.uom_type not in ('reference') then - (select id from product_uom where uom_type='reference' and category_id = 1) + (select id from product_uom where uom_type='reference' and category_id = 1 LIMIT 1) else u.id end) as product_uom, diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index aaaec228d7b..ed457835fb6 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -91,7 +91,7 @@ class sale_report(osv.osv): select l.id as id, l.product_id as product_id, (case when u.uom_type not in ('reference') then - (select name from product_uom where uom_type='reference' and category_id=u.category_id) + (select name from product_uom where uom_type='reference' and category_id=u.category_id LIMIT 1) else u.name end) as uom_name, From 3c8de333a4e648fc3d827e69379990217ee5c792 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 6 Jul 2011 17:36:44 +0530 Subject: [PATCH 016/190] [IMP] add boolean field on account_followup wizard and fix partner_id many2many fields gives error bzr revid: ara@tinyerp.com-20110706120644-etqtptxkmjer6qsa --- addons/account_followup/wizard/account_followup_print.py | 7 ++++--- .../wizard/account_followup_print_view.xml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index a8608c2fdd0..c1b5247dec2 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -115,12 +115,13 @@ class account_followup_print_all(osv.osv_memory): _name = 'account.followup.print.all' _description = 'Print Followup & Send Mail to Customers' _columns = { - 'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True, domain="[('account_id.type', '=', 'receivable'), ('account_id.reconcile', '=', True), ('reconcile_id','=', False), ('state', '!=', 'draft'), ('account_id.active', '=', True), ('debit', '>', 0)]"), + 'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True), 'email_conf': fields.boolean('Send email confirmation'), 'email_subject': fields.char('Email Subject', size=64), 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), - 'summary': fields.text('Summary', required=True, readonly=True) + 'summary': fields.text('Summary', required=True, readonly=True), + 'test': fields.boolean('Test File') } def _get_summary(self, cr, uid, context=None): if context is None: @@ -316,7 +317,7 @@ class account_followup_print_all(osv.osv_memory): data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for id in to_update.keys(): - if to_update[id]['partner_id'] in data['partner_ids']: + if to_update[id]['partner_id'] in data['partner_ids'] and not data['test']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ diff --git a/addons/account_followup/wizard/account_followup_print_view.xml b/addons/account_followup/wizard/account_followup_print_view.xml index af105b17c55..1ece8ea2959 100644 --- a/addons/account_followup/wizard/account_followup_print_view.xml +++ b/addons/account_followup/wizard/account_followup_print_view.xml @@ -86,6 +86,7 @@ + From db4c8d395d520e1388ef3731994e092f29942bc8 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 6 Jul 2011 17:57:33 +0530 Subject: [PATCH 017/190] [IMP] add help on test field bzr revid: ara@tinyerp.com-20110706122733-qszw297j0w7si3q7 --- addons/account_followup/wizard/account_followup_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index c1b5247dec2..d7730c1cfff 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -121,7 +121,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True), - 'test': fields.boolean('Test File') + 'test': fields.boolean('Test File', help='Check if you want to print follow ups without increase follow ups level.') } def _get_summary(self, cr, uid, context=None): if context is None: From 469ca9b5f4bbf1e67d22f63c1fac6905aeac2796 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 6 Jul 2011 17:58:07 +0530 Subject: [PATCH 018/190] [IMP] add help on test field bzr revid: ara@tinyerp.com-20110706122807-t13hbmxzximo561h --- addons/account_followup/wizard/account_followup_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index d7730c1cfff..03f376d9af2 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -121,7 +121,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True), - 'test': fields.boolean('Test File', help='Check if you want to print follow ups without increase follow ups level.') + 'test': fields.boolean('Test File', help='Check if you want to print follow ups without changing follow ups level.') } def _get_summary(self, cr, uid, context=None): if context is None: From 71a33c47bd404488e7beaab04584f9cf67b95478 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 11 Jul 2011 15:39:03 +0530 Subject: [PATCH 019/190] [IMP] account_followups: improve varible name bzr revid: ara@tinyerp.com-20110711100903-dts3dzar0tv95wh3 --- .../wizard/account_followup_print.py | 19 ++++++++++--------- .../wizard/account_followup_print_view.xml | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 03f376d9af2..59cdb915a8f 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -121,7 +121,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True), - 'test': fields.boolean('Test File', help='Check if you want to print follow ups without changing follow ups level.') + 'test_print': fields.boolean('Test Print', help='Check if you want to print followups without changing follow ups level.') } def _get_summary(self, cr, uid, context=None): if context is None: @@ -316,14 +316,15 @@ class account_followup_print_all(osv.osv_memory): to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] - for id in to_update.keys(): - if to_update[id]['partner_id'] in data['partner_ids'] and not data['test']: - cr.execute( - "UPDATE account_move_line "\ - "SET followup_line_id=%s, followup_date=%s "\ - "WHERE id=%s", - (to_update[id]['level'], - date, int(id),)) + if not data['test_print']: + for id in to_update.keys(): + if to_update[id]['partner_id'] in data['partner_ids']: + cr.execute( + "UPDATE account_move_line "\ + "SET followup_line_id=%s, followup_date=%s "\ + "WHERE id=%s", + (to_update[id]['level'], + date, int(id),)) data.update({'date': context['date']}) datas = { 'ids': [], diff --git a/addons/account_followup/wizard/account_followup_print_view.xml b/addons/account_followup/wizard/account_followup_print_view.xml index 1ece8ea2959..9d74060b19a 100644 --- a/addons/account_followup/wizard/account_followup_print_view.xml +++ b/addons/account_followup/wizard/account_followup_print_view.xml @@ -86,7 +86,7 @@ - + From 758ca5c4f47a26152e7edf7afdfc8a4e838591f9 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 11 Jul 2011 15:56:13 +0530 Subject: [PATCH 020/190] [IMP] account_followups: improve varible name bzr revid: ara@tinyerp.com-20110711102613-msoe0my3j7qwil2j --- addons/account_followup/wizard/account_followup_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 59cdb915a8f..794bf13a1d4 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -121,7 +121,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True), - 'test_print': fields.boolean('Test Print', help='Check if you want to print followups without changing follow ups level.') + 'test_print': fields.boolean('Test Print', help='Check if you want to print followups without changing followups level.') } def _get_summary(self, cr, uid, context=None): if context is None: From 236e429cefa9c6c749f4cb4a9f4a20d00a454ecd Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 14 Jul 2011 18:53:19 +0530 Subject: [PATCH 021/190] [IMP]multi_company,purchase:Removing a file of sequence bzr revid: mma@tinyerp.com-20110714132319-3tggg0636kkqsm3v --- addons/multi_company/__openerp__.py | 1 - .../multi_company_purchase_sequence.xml | 31 ------------------- addons/purchase/purchase_sequence.xml | 1 + 3 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 addons/multi_company/multi_company_purchase_sequence.xml diff --git a/addons/multi_company/__openerp__.py b/addons/multi_company/__openerp__.py index beeffc75358..2ae556fe1e7 100644 --- a/addons/multi_company/__openerp__.py +++ b/addons/multi_company/__openerp__.py @@ -40,7 +40,6 @@ This module is the base module for other multi-company modules. 'init_xml': [], 'update_xml': [ 'res_company_view.xml', - 'multi_company_purchase_sequence.xml', ], 'demo_xml': [ 'multi_company_demo.xml' diff --git a/addons/multi_company/multi_company_purchase_sequence.xml b/addons/multi_company/multi_company_purchase_sequence.xml deleted file mode 100644 index 8205866e573..00000000000 --- a/addons/multi_company/multi_company_purchase_sequence.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - Purchase Order - purchase.order - - - - - - Purchase Order - purchase.order - PO - 5 - - - - - Purchase Order - purchase.order - PO - 5 - - - - - diff --git a/addons/purchase/purchase_sequence.xml b/addons/purchase/purchase_sequence.xml index 7f426b53be6..e8a7f43c503 100644 --- a/addons/purchase/purchase_sequence.xml +++ b/addons/purchase/purchase_sequence.xml @@ -11,6 +11,7 @@ purchase.order PO 5 + From 659f408f504a3bb1a44a7d4b49605c0ffc2623d1 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 15 Jul 2011 17:30:59 +0530 Subject: [PATCH 022/190] [FIX]stock:product_uos ,product_uos_qty and address_id field readonly mode when state is done lp bug: https://launchpad.net/bugs/781642 fixed bzr revid: mma@tinyerp.com-20110715120059-m7mhvhfmh6lzoml7 --- addons/stock/stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 310b1067ff8..fffe580aee1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1527,13 +1527,13 @@ class stock_move(osv.osv): 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True,states={'done': [('readonly', True)]}), 'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True,states={'done': [('readonly', True)]}), - 'product_uos_qty': fields.float('Quantity (UOS)', digits_compute=dp.get_precision('Product UoM')), - 'product_uos': fields.many2one('product.uom', 'Product UOS'), + 'product_uos_qty': fields.float('Quantity (UOS)', digits_compute=dp.get_precision('Product UoM'), states={'done': [('readonly', True)]}), + 'product_uos': fields.many2one('product.uom', 'Product UOS', states={'done': [('readonly', True)]}), 'product_packaging': fields.many2one('product.packaging', 'Packaging', help="It specifies attributes of packaging like type, quantity of packaging,etc."), 'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True,states={'done': [('readonly', 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', 'Destination Location', required=True,states={'done': [('readonly', True)]}, select=True, help="Location where the system will stock the finished products."), - 'address_id': fields.many2one('res.partner.address', 'Destination Address', help="Optional address where goods are to be delivered, specifically used for allotment"), + 'address_id': fields.many2one('res.partner.address', 'Destination Address ', states={'done': [('readonly', True)]}, help="Optional address where goods are to be delivered, specifically used for allotment"), 'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', states={'done': [('readonly', True)]}, help="Production lot is used to put a serial number on the production", select=True), 'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, states={'done': [('readonly', True)]}, help="Logistical shipping unit: pallet, box, pack ..."), From 2380552cb493040b22e61f8e4209cc6df8edc912 Mon Sep 17 00:00:00 2001 From: guillem <> Date: Tue, 19 Jul 2011 11:19:15 +0530 Subject: [PATCH 023/190] [FIX] crm helpdesk : don't list categories without section lp bug: https://launchpad.net/bugs/810404 fixed bzr revid: dbr@tinyerp.com-20110719054915-3qlup3512yktkpko --- addons/crm_helpdesk/crm_helpdesk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index 5d02ec12369..f8f1bca6fa0 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -71,7 +71,7 @@ class crm_helpdesk(crm.crm_case, osv.osv): 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'probability': fields.float('Probability (%)'), 'categ_id': fields.many2one('crm.case.categ', 'Category', \ - domain="[('section_id','=',section_id),\ + domain="['|',('section_id','=',False),('section_id','=',section_id),\ ('object_id.model', '=', 'crm.helpdesk')]"), 'duration': fields.float('Duration', states={'done': [('readonly', True)]}), 'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True, From cab72a2d5451e5c48f91b91e0c7dfc652351d6b2 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Wed, 20 Jul 2011 14:25:05 +0530 Subject: [PATCH 024/190] [FIX]:when merging PO put minimum order date of all merged PO lp bug: https://launchpad.net/bugs/812871 fixed bzr revid: ksa@tinyerp.co.in-20110720085505-q17ufdhft9znoefi --- addons/purchase/purchase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6ec558acc97..ccd9817f2c8 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -532,6 +532,7 @@ class purchase_order(osv.osv): new_orders = {} for porder in [order for order in self.browse(cr, uid, ids, context=context) if order.state == 'draft']: + date_orders = sorted([obj.date_order for obj in self.browse(cr, uid, ids, context=context)]) order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id')) new_order = new_orders.setdefault(order_key, ({}, [])) new_order[1].append(porder.id) @@ -539,7 +540,7 @@ class purchase_order(osv.osv): if not order_infos: order_infos.update({ 'origin': porder.origin, - 'date_order': time.strftime('%Y-%m-%d'), + 'date_order': date_orders[0], 'partner_id': porder.partner_id.id, 'partner_address_id': porder.partner_address_id.id, 'dest_address_id': porder.dest_address_id.id, From 431b93bd59fe18a77a1ee3971e497e64da2eed81 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Wed, 20 Jul 2011 15:16:39 +0530 Subject: [PATCH 025/190] [FIX]:wrong scheduled date and order date for PO generated from procurement lp bug: https://launchpad.net/bugs/812794 fixed bzr revid: ksa@tinyerp.co.in-20110720094639-u0hujqlwotv2cgo7 --- addons/purchase/purchase.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6ec558acc97..3818060c9b5 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -792,8 +792,9 @@ class procurement_order(osv.osv): price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id] - newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - newdate = (newdate - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay) + order_date = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') + order_date = (order_date - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay) + schedule_date = (order_date - relativedelta(days=company.po_lead)) #Passing partner_id to context for purchase order line integrity of Line name context.update({'lang': partner.lang, 'partner_id': partner_id}) @@ -806,7 +807,7 @@ class procurement_order(osv.osv): 'product_id': procurement.product_id.id, 'product_uom': uom_id, 'price_unit': price, - 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), + 'date_planned': schedule_date.strftime('%Y-%m-%d %H:%M:%S'), 'move_dest_id': res_id, 'notes': product.description_purchase, } @@ -822,6 +823,7 @@ class procurement_order(osv.osv): 'partner_address_id': address_id, 'location_id': procurement.location_id.id, 'pricelist_id': pricelist_id, + 'date_order': order_date.strftime('%Y-%m-%d %H:%M:%S'), 'order_line': [(0,0,line)], 'company_id': procurement.company_id.id, 'fiscal_position': partner.property_account_position and partner.property_account_position.id or False From 4c81cfbebd33e2755ae68aed2396cf750a289c13 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 20 Jul 2011 17:22:35 +0530 Subject: [PATCH 026/190] [IMP]multi_company,purchase:Remove a demo data and sql constraint bzr revid: mma@tinyerp.com-20110720115235-k3grrx9ast556sj1 --- addons/multi_company/__openerp__.py | 2 +- addons/multi_company/multi_company_demo.xml | 26 --------------------- addons/purchase/purchase.py | 2 +- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/addons/multi_company/__openerp__.py b/addons/multi_company/__openerp__.py index 2ae556fe1e7..baf3a88c32e 100644 --- a/addons/multi_company/__openerp__.py +++ b/addons/multi_company/__openerp__.py @@ -39,7 +39,7 @@ This module is the base module for other multi-company modules. ], 'init_xml': [], 'update_xml': [ - 'res_company_view.xml', + 'res_company_view.xml' ], 'demo_xml': [ 'multi_company_demo.xml' diff --git a/addons/multi_company/multi_company_demo.xml b/addons/multi_company/multi_company_demo.xml index 583f83d252d..5248a26f4f9 100644 --- a/addons/multi_company/multi_company_demo.xml +++ b/addons/multi_company/multi_company_demo.xml @@ -268,32 +268,6 @@ - - Expenses Journal - (Shop 1) - EXJ-Shop 1 - purchase - - - - - - - - - - - Expenses Journal - (Shop 2) - EXJ-Shop 2 - purchase - - - - - - - - - Expenses Credit Notes Journal - (OpenERP IN) ECNJ-OpenERP IN diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 436ec0b021b..6f6ab0c1b44 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -228,7 +228,7 @@ class purchase_order(osv.osv): 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), } _sql_constraints = [ - ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique !'), + ('name_uniq', 'unique(name)', 'Order Reference must be unique !'), ] _name = "purchase.order" _description = "Purchase Order" From bf8d91d99cd67ab118b4d1a3512299de7c857d75 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 21 Jul 2011 10:10:50 +0530 Subject: [PATCH 027/190] [IMP]:use min instead of sort bzr revid: ksa@tinyerp.co.in-20110721044050-9lmfuxyvw0nv7z5c --- addons/purchase/purchase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ccd9817f2c8..e029aac1c0d 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -532,7 +532,7 @@ class purchase_order(osv.osv): new_orders = {} for porder in [order for order in self.browse(cr, uid, ids, context=context) if order.state == 'draft']: - date_orders = sorted([obj.date_order for obj in self.browse(cr, uid, ids, context=context)]) + date_orders = min([obj.date_order for obj in self.browse(cr, uid, ids, context=context)]) order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id')) new_order = new_orders.setdefault(order_key, ({}, [])) new_order[1].append(porder.id) @@ -540,7 +540,7 @@ class purchase_order(osv.osv): if not order_infos: order_infos.update({ 'origin': porder.origin, - 'date_order': date_orders[0], + 'date_order': date_orders, 'partner_id': porder.partner_id.id, 'partner_address_id': porder.partner_address_id.id, 'dest_address_id': porder.dest_address_id.id, From 8691e4b906fb4c114fa687665953a978b7efe2c8 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 21 Jul 2011 11:29:40 +0530 Subject: [PATCH 028/190] [IMP]:improve bzr revid: ksa@tinyerp.co.in-20110721055940-poqs2hb1ppvxdss9 --- addons/purchase/purchase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3818060c9b5..67223903219 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -793,7 +793,7 @@ class procurement_order(osv.osv): price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id] order_date = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - order_date = (order_date - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay) + order_dates = (order_date - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay) schedule_date = (order_date - relativedelta(days=company.po_lead)) #Passing partner_id to context for purchase order line integrity of Line name @@ -823,7 +823,7 @@ class procurement_order(osv.osv): 'partner_address_id': address_id, 'location_id': procurement.location_id.id, 'pricelist_id': pricelist_id, - 'date_order': order_date.strftime('%Y-%m-%d %H:%M:%S'), + 'date_order': order_dates.strftime('%Y-%m-%d %H:%M:%S'), 'order_line': [(0,0,line)], 'company_id': procurement.company_id.id, 'fiscal_position': partner.property_account_position and partner.property_account_position.id or False From bfcfaf85c401d4692175a6bbf3a48dcfd16a22e3 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Thu, 21 Jul 2011 11:58:03 +0530 Subject: [PATCH 029/190] [FIX] stock: Accounting entries from goods receipt now broken lp bug: https://launchpad.net/bugs/797477 fixed bzr revid: psi@tinyerp.co.in-20110721062803-t1hqbapndzsq6qsa --- addons/stock/wizard/stock_invoice_onshipping.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index 42add8019c4..06951a717d9 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -38,7 +38,7 @@ class stock_invoice_onshipping(osv.osv_memory): res_ids = context and context.get('active_ids', []) vals = [] browse_picking = model_pool.browse(cr, uid, res_ids, context=context) - + for pick in browse_picking: src_usage = pick.move_lines[0].location_id.usage dest_usage = pick.move_lines[0].location_dest_id.usage @@ -53,7 +53,7 @@ class stock_invoice_onshipping(osv.osv_memory): journal_type = 'sale_refund' else: journal_type = 'sale' - + value = journal_obj.search(cr, uid, [('type', '=',journal_type )]) for jr_type in journal_obj.browse(cr, uid, value, context=context): t1 = jr_type.id,jr_type.name @@ -129,7 +129,7 @@ class stock_invoice_onshipping(osv.osv_memory): res = picking_pool.action_invoice_create(cr, uid, active_ids, journal_id = onshipdata_obj[0]['journal_id'], group = onshipdata_obj[0]['group'], - type = None, + type = inv_type, context=context) return res From 97b38de7c5b20c72c8300e5e415243167a5b956f Mon Sep 17 00:00:00 2001 From: "Graeme Gellatly (gdgellatly)" <> Date: Thu, 21 Jul 2011 12:01:39 +0530 Subject: [PATCH 030/190] [FIX] stock: Accounting entries from goods receipt now broken lp bug: https://launchpad.net/bugs/797477 fixed bzr revid: psi@tinyerp.co.in-20110721063139-383nbh9v2elp407x --- addons/stock/wizard/stock_invoice_onshipping.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index 42add8019c4..06951a717d9 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -38,7 +38,7 @@ class stock_invoice_onshipping(osv.osv_memory): res_ids = context and context.get('active_ids', []) vals = [] browse_picking = model_pool.browse(cr, uid, res_ids, context=context) - + for pick in browse_picking: src_usage = pick.move_lines[0].location_id.usage dest_usage = pick.move_lines[0].location_dest_id.usage @@ -53,7 +53,7 @@ class stock_invoice_onshipping(osv.osv_memory): journal_type = 'sale_refund' else: journal_type = 'sale' - + value = journal_obj.search(cr, uid, [('type', '=',journal_type )]) for jr_type in journal_obj.browse(cr, uid, value, context=context): t1 = jr_type.id,jr_type.name @@ -129,7 +129,7 @@ class stock_invoice_onshipping(osv.osv_memory): res = picking_pool.action_invoice_create(cr, uid, active_ids, journal_id = onshipdata_obj[0]['journal_id'], group = onshipdata_obj[0]['group'], - type = None, + type = inv_type, context=context) return res From 8e7247624f590a209099707b6b920f66d03f21c7 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Thu, 21 Jul 2011 14:44:32 +0530 Subject: [PATCH 031/190] [FIX] res_partner bank - IBAN must check for SWIFT/BIC in res_bank lp bug: https://launchpad.net/bugs/805996 fixed bzr revid: ara@tinyerp.com-20110721091432-xavmr81nh4s4q237 --- addons/base_iban/base_iban.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index f473bd090c0..feb36dd8a47 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -120,6 +120,15 @@ class res_partner_bank(osv.osv): return _('The IBAN does not seem to be correct. You should have entered something like this %s'), (iban_example) return _('The IBAN is invalid, It should begin with the country code'), () + def _check_bank(self, cr, uid, ids, context=None): + if context is None: + context = {} + banks = self.browse(cr, uid, ids, context=context) + for bank in banks: + if bank.state == 'iban' and not bank.bank.bic: + return False + return True + def name_get(self, cr, uid, ids, context=None): res = [] to_check_ids = [] @@ -172,8 +181,7 @@ class res_partner_bank(osv.osv): _columns = { 'iban': fields.char('IBAN', size=34, readonly=True, help="International Bank Account Number"), } - - _constraints = [(check_iban, _construct_constraint_msg, ["iban"])] + _constraints = [(check_iban, _construct_constraint_msg, ["iban"]), (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['BIC/Swift code'])] res_partner_bank() From 5783538775c9af6483bb6fa305d9fb91ec05ab5b Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Thu, 21 Jul 2011 15:29:35 +0530 Subject: [PATCH 032/190] [FIX] account : Added the company_id in product_id_change method in account_anglo_saxon module lp bug: https://launchpad.net/bugs/813329 fixed bzr revid: bde@tinyerp.com-20110721095935-fm8t1pq9rg2rgdts --- addons/account_anglo_saxon/invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index c37a93b4be4..e8a650e6a50 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -136,11 +136,11 @@ class account_invoice_line(osv.osv): res += diff_res return res - def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None, company_id=None): if not product: - return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context) + return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id) else: - res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context) + res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id) if type in ('in_invoice','in_refund'): product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context) From fcbab41369587f7069f8e275fe00b1ff1c3b51a0 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 21 Jul 2011 16:51:40 +0530 Subject: [PATCH 033/190] [IMP]:get order date accoring to partner bzr revid: ksa@tinyerp.co.in-20110721112140-rzfouzx1x5zsrk71 --- addons/purchase/purchase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e029aac1c0d..012c9a8bbfb 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -532,7 +532,8 @@ class purchase_order(osv.osv): new_orders = {} for porder in [order for order in self.browse(cr, uid, ids, context=context) if order.state == 'draft']: - date_orders = min([obj.date_order for obj in self.browse(cr, uid, ids, context=context)]) + partner_ids = self.search(cr,uid,[('partner_id','=',porder.partner_id.id)]) + date_orders = min([obj.date_order for obj in self.browse(cr, uid, partner_ids, context=context)]) order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id')) new_order = new_orders.setdefault(order_key, ({}, [])) new_order[1].append(porder.id) From 8c7faca654db02b7b208ab65723d5f4491d74b34 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Fri, 22 Jul 2011 11:58:39 +0530 Subject: [PATCH 034/190] [FIX] changed the internal_type and user_type of account when Generic chart of account is configured lp bug: https://launchpad.net/bugs/814053 fixed bzr revid: bde@tinyerp.com-20110722062839-lwmg8oigwm9jt11h --- addons/account/configurable_account_chart.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index fbae77349af..81d01ee4c10 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -187,8 +187,8 @@ 1104 Bank Current Account - liquidity - + view + @@ -447,7 +447,7 @@ - + @@ -612,7 +612,7 @@ - + Generate Chart of Accounts from a Chart Template From 6fa4a0491c5573be62d642bc7d394d2c4b323f35 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Fri, 22 Jul 2011 11:59:13 +0530 Subject: [PATCH 035/190] [IMP]:improved bzr revid: ksa@tinyerp.co.in-20110722062913-9roigkh4i6etvpj6 --- addons/purchase/purchase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 012c9a8bbfb..723f5e426c8 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -532,8 +532,6 @@ class purchase_order(osv.osv): new_orders = {} for porder in [order for order in self.browse(cr, uid, ids, context=context) if order.state == 'draft']: - partner_ids = self.search(cr,uid,[('partner_id','=',porder.partner_id.id)]) - date_orders = min([obj.date_order for obj in self.browse(cr, uid, partner_ids, context=context)]) order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id')) new_order = new_orders.setdefault(order_key, ({}, [])) new_order[1].append(porder.id) @@ -541,7 +539,7 @@ class purchase_order(osv.osv): if not order_infos: order_infos.update({ 'origin': porder.origin, - 'date_order': date_orders, + 'date_order': porder.date_order, 'partner_id': porder.partner_id.id, 'partner_address_id': porder.partner_address_id.id, 'dest_address_id': porder.dest_address_id.id, @@ -554,6 +552,8 @@ class purchase_order(osv.osv): 'fiscal_position': porder.fiscal_position and porder.fiscal_position.id or False, }) else: + if porder.date_order < order_infos['date_order']: + order_infos['date_order'] = porder.date_order if porder.notes: order_infos['notes'] = (order_infos['notes'] or '') + ('\n%s' % (porder.notes,)) if porder.origin: From f1b56240b0ea6265a384a4946cc478c414073d67 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Fri, 22 Jul 2011 18:53:24 +0530 Subject: [PATCH 036/190] [IMP]: improve code bzr revid: ksa@tinyerp.co.in-20110722132324-ojbbzlcp0xrl3jvt --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 67223903219..0d6e75437ff 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -793,8 +793,8 @@ class procurement_order(osv.osv): price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id] order_date = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - order_dates = (order_date - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay) schedule_date = (order_date - relativedelta(days=company.po_lead)) + order_dates = schedule_date - relativedelta(days=seller_delay) #Passing partner_id to context for purchase order line integrity of Line name context.update({'lang': partner.lang, 'partner_id': partner_id}) From 4df2c92250819fb18360b177144967498e740ab1 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 25 Jul 2011 14:51:57 +0530 Subject: [PATCH 037/190] [FIX] res_partner bank - IBAN must check for SWIFT/BIC in res_bank bzr revid: ara@tinyerp.com-20110725092157-pxtdtjf930usk3dl --- addons/base_iban/base_iban.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index feb36dd8a47..446db474f65 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -121,11 +121,8 @@ class res_partner_bank(osv.osv): return _('The IBAN is invalid, It should begin with the country code'), () def _check_bank(self, cr, uid, ids, context=None): - if context is None: - context = {} - banks = self.browse(cr, uid, ids, context=context) - for bank in banks: - if bank.state == 'iban' and not bank.bank.bic: + for partner_bank in self.browse(cr, uid, ids, context=context): + if partner_bank.state == 'iban' and not partner_bank.bank.bic: return False return True From e678571316569ddda52825d2cd8cd72b5e20ab22 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 25 Jul 2011 15:44:24 +0530 Subject: [PATCH 038/190] [IMP] account_anglo_saxon: Improve code bzr revid: mra@mra-laptop-20110725101424-q3zlft8s7tsz8dys --- addons/account_anglo_saxon/invoice.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index e8a650e6a50..2bdac8b01fe 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -134,14 +134,13 @@ class account_invoice_line(osv.osv): 'taxes':line.get('taxes',[]), }) res += diff_res - return res - - def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None, company_id=None): - if not product: - return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id) - else: - res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id) + return res + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None, company_id=None): + fiscal_pool = self.pool.get('account.fiscal.position') + res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id) + if not product: + return res if type in ('in_invoice','in_refund'): product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context) if type == 'in_invoice': @@ -153,11 +152,11 @@ class account_invoice_line(osv.osv): if not oa: oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id if oa: - fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id, context=context) or False - a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) - res['value'].update({'account_id':a}) + fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False + a = fiscal_pool.map_account(cr, uid, fpos, oa) + res['value'].update({'account_id':a}) return res - + account_invoice_line() class account_invoice(osv.osv): @@ -180,6 +179,6 @@ class account_invoice(osv.osv): line.update({'account_id': (account_data['id'],account_data['name'])}) res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines) return res - + account_invoice() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 9466968e63f5d948a18a46739fb7ef1eeed140c5 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Mon, 25 Jul 2011 16:36:34 +0530 Subject: [PATCH 039/190] [IMP] changed the account type to Asset View bzr revid: bde@tinyerp.com-20110725110634-orjxdm836m5zzrif --- addons/account/configurable_account_chart.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index 81d01ee4c10..2c999cf1094 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -188,7 +188,7 @@ Bank Current Account view - + From 161b3bd233e3146ed7211019fc069ad40468cbb6 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Thu, 28 Jul 2011 14:48:10 +0530 Subject: [PATCH 040/190] [FIX] res_partner bank - IBAN must check for SWIFT/BIC in res_bank bzr revid: ara@tinyerp.com-20110728091810-akm54utmf4wrbs98 --- addons/base_iban/base_iban.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index 446db474f65..ef752203c3f 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -178,7 +178,7 @@ class res_partner_bank(osv.osv): _columns = { 'iban': fields.char('IBAN', size=34, readonly=True, help="International Bank Account Number"), } - _constraints = [(check_iban, _construct_constraint_msg, ["iban"]), (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['BIC/Swift code'])] + _constraints = [(check_iban, _construct_constraint_msg, ["iban"]), (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['bic'])] res_partner_bank() From 4f149e642b7e4e9cf5dc298d895c80fef5ffc298 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 29 Jul 2011 16:49:53 +0530 Subject: [PATCH 041/190] [IMP]stock:Improvement in yml bzr revid: mma@tinyerp.com-20110729111953-0mbb9za6nhn0hhl9 --- addons/stock/__openerp__.py | 1 + addons/stock/report/UPS.xml | 28 ------ addons/stock/report/__init__.py | 1 - addons/stock/report/ups.py | 39 -------- addons/stock/test/stock_test.yml | 116 +++++++++++++++++++++-- addons/stock/test/stock_test_wizard.yml | 120 ++++++++++++++++++++++++ addons/stock/wizard/__init__.py | 1 - addons/stock/wizard/stock_ups.py | 95 ------------------- addons/stock/wizard/stock_ups_view.xml | 56 ----------- 9 files changed, 231 insertions(+), 226 deletions(-) delete mode 100644 addons/stock/report/UPS.xml delete mode 100644 addons/stock/report/ups.py create mode 100644 addons/stock/test/stock_test_wizard.yml delete mode 100644 addons/stock/wizard/stock_ups.py delete mode 100644 addons/stock/wizard/stock_ups_view.xml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 1a33fd3012c..3447f0c8358 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -79,6 +79,7 @@ Thanks to the double entry management, the inventory controlling is powerful and ], 'test': ['test/stock_test.yml', 'test/stock_report.yml', + 'test/stock_test_wizard.yml', ], 'installable': True, 'active': False, diff --git a/addons/stock/report/UPS.xml b/addons/stock/report/UPS.xml deleted file mode 100644 index 0349fda556d..00000000000 --- a/addons/stock/report/UPS.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - ES - - 1 - - - PP - - - - - diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py index 18bfe2609c2..412e77f3f17 100644 --- a/addons/stock/report/__init__.py +++ b/addons/stock/report/__init__.py @@ -20,7 +20,6 @@ ############################################################################## import product_stock -import ups import picking import lot_overview_all import report_stock diff --git a/addons/stock/report/ups.py b/addons/stock/report/ups.py deleted file mode 100644 index fb8483341ec..00000000000 --- a/addons/stock/report/ups.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -from report.interface import report_rml - -class report_custom(report_rml): - def create(self, uid, ids, datas, context): - datas.setdefault('form', {}) - datas['form'].setdefault('weight', 3.0) - - datas['model'] = 'stock.move.lot' - datas['ids'] = ids - del datas['id'] - - return (super(report_custom, self).create(uid, ids, datas, context), 'pdf') - -report_custom('report.stock.move.lot.ups_xml', 'stock.move.lot', 'addons/stock/report/UPS.xml', None) - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/stock/test/stock_test.yml b/addons/stock/test/stock_test.yml index 762908e6b0c..2a6b7b37aeb 100644 --- a/addons/stock/test/stock_test.yml +++ b/addons/stock/test/stock_test.yml @@ -205,8 +205,9 @@ - !record {model: product.product, id: product_product_hpcdwriters0}: categ_id: stock.product_category_computer0 - cost_method: standard - list_price: 1000.0 + cost_method: average + list_price: 1500.0 + standard_price: 1500.0 mes_type: fixed name: HP CD writers procure_method: make_to_stock @@ -220,7 +221,47 @@ uom_po_id: product.product_uom_unit property_account_expense: account_account_productpurchase0 property_account_income: account_account_productsale0 +- + I create change product quantity for product HP CD writers. +- + !record {model: stock.change.product.qty, id: stock_change_product_qty0}: + product_id: stock.product_product_hpcdwriters0 + new_quantity: 10 + location_id: stock.stock_location_stock +- + I apply the new quantity on product HP CD writers. +- + !python {model: stock.change.product.qty }: | + self.change_product_qty(cr, uid, [ref("stock_change_product_qty0")], {"lang": 'en_US', "active_model": + "stock.change.product.qty", "active_ids": ref("stock.product_product_hpcdwriters0"), "tz": False, "active_id":ref('stock.product_product_hpcdwriters0')}) +- + I Read quantity on product HP CD writers. +- + !python {model: stock.location }: | + self.read(cr, uid, [ref("stock.stock_location_stock")],['stock_real_value','stock_virtual'], {'lang': 'en_GB', 'tz': False, 'active_model': 'product.product', 'bin_size': True, 'active_ids': [ref("stock.product_product_hpcdwriters0")], 'product_id':ref("stock.product_product_hpcdwriters0"), 'active_id': ref("stock.product_product_hpcdwriters0")}) +- + I create change location. +- + !python {model: stock.location }: | + to=self.browse(cr,uid,ref('stock.stock_location_stock')) + form=self.browse(cr,uid,ref('stock.stock_location_locations')) + self.picking_type_get(cr, uid, to, form) +- + I create change product standard price for product HP CD writers. +- + !record {model: stock.change.standard.price, id: stock_change_standard_price0}: + new_price: 15 + stock_account_input: account_account_receivable0 + stock_account_output: account_account_payable0 + stock_journal: account_journal_purchasejournal0 + enable_stock_in_out_acc: True +- + I apply the new product standard price on product HP CD writers. +- + !python {model: stock.change.standard.price }: | + self.change_price(cr, uid, [ref("stock_change_product_qty0")], {"lang": 'en_US', "active_model": + "product.product", "active_ids": [ref("stock.product_product_hpcdwriters0")], "tz": False, "active_id":ref('stock.product_product_hpcdwriters0')}) - I create Physical Inventory for the products. - @@ -241,14 +282,62 @@ product_uom: product.product_uom_unit name: Physical inventory state: draft - - +- + I create merge Inventory for the products. +- + !record {model: stock.inventory, id: stock_inventory_mergeinventoy0}: + company_id: base.main_company + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') + date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S') + inventory_line_id: + - company_id: base.main_company + location_id: stock.stock_location_stock + product_id: stock.product_product_hpcdwriters0 + product_qty: 20.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: 20.0 + product_uom: product.product_uom_unit + name: Physical inventory + state: draft +- + I merge inventory . +- + !python {model: stock.inventory.merge}: | + self.do_merge(cr, uid, [ref("stock_inventory_mergeinventoy0")], {"lang": 'en_US', + "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids": + [ref("stock_inventory_physicalinventoy0"), ref("stock_inventory_mergeinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), }) - I confirm the Inventory for HP CD writers. - !python {model: stock.inventory}: | self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')]) self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')]) +- + I create stock.inventory.line.split record. +- + !record {model: stock.inventory.line.split, id: stock_inventory_line_0}: + line_ids: + - name: '00002-stock-test' + quantity: 5 + use_exist: False + product_id: stock.product_product_hpcdwriters0 + product_uom: product.product_uom_unit + use_exist: False + qty: 10 +- + I Split stock.inventory.line into production line. +- + !python {model: stock.inventory.line.split}: | + move_obj=self.pool.get('stock.inventory.line') + 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_inventory_line_0")], {"lang": 'en_US', "active_model": + "stock.inventory.line", "active_ids": move_ids, "tz": False, "active_id":move_ids[0] + }) - I create stock.fill.inventory . - @@ -284,7 +373,6 @@ "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}: @@ -307,7 +395,22 @@ move_type: direct type: internal - +- + I create stock split.into quantity record. +- + !record {model: stock.split.into, id: stock_split_into0}: + quantity: 1 +- + I apply the split quantity. +- + !python {model: stock.split.into}: | + 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(cr, uid, [ref("stock_split_into0")], {"lang": 'en_US', "active_model": + "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0] + }) - I click on draft_force_assign on picking. - @@ -345,3 +448,4 @@ 'product_uom': move.product_uom.id, } self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas) + diff --git a/addons/stock/test/stock_test_wizard.yml b/addons/stock/test/stock_test_wizard.yml new file mode 100644 index 00000000000..c7e870a8d7d --- /dev/null +++ b/addons/stock/test/stock_test_wizard.yml @@ -0,0 +1,120 @@ + +- + In order to test picking i created picking record with move lines +- + !record {model: stock.picking, id: stock_picking_in0}: + address_id: base.main_address + company_id: base.main_company + invoice_state: 2binvoiced + move_lines: + - location_dest_id: stock.stock_location_shop0 + product_id: product.product_product_pc1 + product_qty: 30.0 + product_uom: product.product_uom_unit + date_expected : '2011-01-05 12:58:07' + location_id : stock.stock_location_suppliers + name : '[PC1] Basic PC' + product_uos_qty : 30.0 + name: IN/00010 + type: in + +- + I performed an osv_memory action draft_validate on module stock.picking +- + !python {model: stock.picking}: | + self.draft_validate(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US", "search_default_available": + 1, "tz": False, "active_model": "ir.ui.menu", "section_id": False, "contact_display": + "partner_address", "active_ids": [ref("stock.menu_action_picking_tree4")], + "active_id": ref("stock.menu_action_picking_tree4"), }) + +- + I confirm the picking. +- + + !python {model: stock.picking }: | + import time + pick=self.browse(cr,uid,ref('stock_picking_in0')) + partial_datas={} + for move in pick.move_lines: + partial_datas['move%s'%(move.id)]= { + 'product_id': move.product_id, + 'product_qty': move.product_qty, + } + self.do_partial(cr, uid, [pick.id],partial_datas) +- + I Performing an osv_memory action create_invoice on module stock.invoice.onshipping +- + !python {model: stock.invoice.onshipping}: | + pick=self.browse(cr,uid,ref('stock_picking_in0')) + invoice_line_id = self.pool.get('stock.invoice.onshipping').create(cr, uid,{}, {"lang": 'en_US', "active_model": + "stock.picking", "active_ids": [pick.id], "tz": False, "active_id":pick.id}) + self.open_invoice(cr, uid, [invoice_line_id], {"lang": "en_US", + "search_default_available": 1, "inv_type": "in_invoice" , "tz": False, "active_model": "stock.picking", + "contact_display": "partner_address", "active_ids": [ref("stock_picking_in0")], + "active_id": ref("stock_picking_in0"), }) +- + I Performed an osv_memory action move_scrap and consume move on module stock.move.scrap +- + + !python {model: stock.picking }: | + import time + location_obj = self.pool.get('stock.location') + scrpaed_location_ids = location_obj.search(cr, uid, [('scrap_location','=',True)]) + pick=self.browse(cr,uid,ref('stock_picking_in0')) + scrap_obj=self.pool.get('stock.move.scrap') + consume_obj=self.pool.get('stock.move.consume') + partial_datas={} + move=pick.move_lines[0] + partial_datas= { + 'product_id': move.product_id.id, + 'location_id': scrpaed_location_ids[0], + 'product_qty': move.product_qty, + 'product_uom': move.product_uom.id, + } + scrap_id = self.pool.get('stock.move.scrap').create(cr, uid, partial_datas) + scrap_obj.move_scrap(cr, uid, [scrap_id], {"lang": "en_US", "tz": + False, "active_model": "stock.move", "scrap": True, "active_ids": [move.id], + "active_id": move.id, }) + consume_id = self.pool.get('stock.move.consume').create(cr, uid, partial_datas) + consume_obj.do_move_consume(cr, uid, [consume_id], {"lang": "en_US", "tz": + False, "active_model": "stock.move", "scrap": True, "active_ids": [move.id], + "active_id": move.id, }) +- + I return the picking. +- + + !python {model: stock.picking }: | + import time + pick=self.browse(cr,uid,ref('stock_picking_in0')) + partial_datas={} + partial_pick_id = self.pool.get('stock.return.picking').create(cr, uid,{}, {"lang": 'en_US', "active_model": + "stock.picking", "active_ids": [pick.id], "tz": False, "active_id":pick.id}) + for move in pick.move_lines: + partial_datas= { + 'product_id': move.product_id.id, + 'quantity': move.product_qty, + } + self.pool.get('stock.return.picking').create_returns(cr, uid, [partial_pick_id], {"lang": 'en_US', "active_model": + "stock.picking", "active_ids": [pick.id], "tz": False, "active_id":pick.id}) + +- + I create stock.move record. +- + + !python {model: stock.move }: | + import time + pick_obj = self.pool.get('stock.picking') + pick=pick_obj.browse(cr,uid,ref('stock_picking_in0')) + partial_move_id = self.pool.get('stock.partial.move').create(cr, uid,{}) + search_id = self.search(cr, uid, [('picking_id', '=', pick.id)]) + partial_datas={} + for move in pick.move_lines: + partial_datas['move%s'%(move.id)]= { + 'quantity': move.product_qty, + 'product_uom': move.product_uom.id, + 'prodlot_id': move.prodlot_id and move.prodlot_id.id or False, + 'wizard_id': partial_move_id, + } + self.do_partial(cr, uid, [partial_move_id],partial_datas,{"lang": 'en_US', "active_model": + "stock.move", 'search_default_receive': 1, 'product_receive': True, "active_ids": search_id, "tz": False, "active_id":search_id[0]}) + \ No newline at end of file diff --git a/addons/stock/wizard/__init__.py b/addons/stock/wizard/__init__.py index b903f020f82..b0b091be07a 100644 --- a/addons/stock/wizard/__init__.py +++ b/addons/stock/wizard/__init__.py @@ -25,7 +25,6 @@ import stock_splitinto import stock_partial_picking import stock_partial_move import stock_replacement -import stock_ups import stock_inventory_merge import stock_fill_inventory import stock_inventory_line_split diff --git a/addons/stock/wizard/stock_ups.py b/addons/stock/wizard/stock_ups.py deleted file mode 100644 index fb47587f254..00000000000 --- a/addons/stock/wizard/stock_ups.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -import netsvc -from osv import fields, osv -from tools.translate import _ - -class stock_ups(osv.osv_memory): - _name = "stock.ups" - _description = "Stock ups" - - def ups_save(self, cr, uid, ids, context=None): - 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=None): - 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=None): - """ Creates xml report file. - @return: xml file - """ - data={} - 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=None): - """ Uploads xml report file. - @return: - """ - data={} - report = netsvc._group['report']['report.stock.move.lot.ups_xml'] - data['report_type'] = 'raw' - fp = file('/tmp/test.xml', 'w').write(report.create(uid, context['active_id'], ids, {})) - return {'type': 'ir.actions.act_window_close'} - -stock_ups_upload() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/stock/wizard/stock_ups_view.xml b/addons/stock/wizard/stock_ups_view.xml deleted file mode 100644 index cbce721e1b9..00000000000 --- a/addons/stock/wizard/stock_ups_view.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - Stock ups - stock.ups - form - -
- - - -