From 224caa68bef0e72b705dad21303cbbe570426d76 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 4 Aug 2010 20:59:19 +0200 Subject: [PATCH 01/15] [REVERT] sale: reverted incorrect model change in sale.order.line, we need to be able to have multiple invoice.lines per sale.order.line bzr revid: odo@openerp.com-20100804185919-imyt8sm0bzzsbmf6 --- addons/sale/sale.py | 19 ++++++++++--------- addons/sale/sale_view.xml | 8 ++++---- addons/sale/stock.py | 4 ++-- addons/sale_layout/sale_layout_view.xml | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index ac27fac214d..21ca506bb83 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -328,7 +328,7 @@ class sale_order(osv.osv): cr.execute('select id from sale_order_line where order_id IN %s and state=%s',(tuple(ids),'cancel')) line_ids = map(lambda x: x[0], cr.fetchall()) self.write(cr, uid, ids, {'state': 'draft', 'invoice_ids': [], 'shipped': 0}) - self.pool.get('sale.order.line').write(cr, uid, line_ids, {'invoiced': False, 'state': 'draft', 'line_invoice_id': False}) + self.pool.get('sale.order.line').write(cr, uid, line_ids, {'invoiced': False, 'state': 'draft', 'invoice_lines': [(6, 0, [])]}) wf_service = netsvc.LocalService("workflow") for inv_id in ids: # Deleting the existing instance of workflow for SO @@ -512,10 +512,11 @@ class sale_order(osv.osv): for sale in self.browse(cr, uid, ids, context=context): for line in sale.order_line: invoiced = False - if line.line_invoice_id and line.line_invoice_id.invoice_id.state == 'cancel': - continue - else: - invoiced = True + for iline in line.invoice_lines: + if iline.invoice_id and iline.invoice_id.state == 'cancel': + continue + else: + invoiced = True self.pool.get('sale.order.line').write(cr, uid, [line.id], {'invoiced': invoiced}) self.write(cr, uid, ids, {'state': 'invoice_except', 'invoice_ids': False}) return True @@ -805,8 +806,7 @@ class sale_order_line(osv.osv): 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of sale order lines."), 'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the the shipping of the products to the customer", readonly=True, states={'draft':[('readonly',False)]}), 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True), -# 'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True), - 'line_invoice_id': fields.many2one('account.invoice.line','Invoice Line',readonly=True), + 'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True), 'invoiced': fields.boolean('Invoiced', readonly=True), 'procurement_id': fields.many2one('procurement.order', 'Procurement'), 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft':[('readonly',False)]}), @@ -918,7 +918,8 @@ class sale_order_line(osv.osv): 'note': line.notes, 'account_analytic_id': line.order_id.project_id and line.order_id.project_id.id or False, }) - self.write(cr, uid, [line.id], {'invoiced': True, 'line_invoice_id':inv_id}) + cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id)) + self.write(cr, uid, [line.id], {'invoiced': True}) sales[line.order_id.id] = True create_ids.append(inv_id) # Trigger workflow events @@ -981,7 +982,7 @@ class sale_order_line(osv.osv): context = {} if not default: default = {} - default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'line_invoice_id': False}) + default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index dbe4e876f27..69b9b1c094a 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -175,8 +175,8 @@ - - + + @@ -414,8 +414,8 @@ - - + + diff --git a/addons/sale/stock.py b/addons/sale/stock.py index e7020ff2515..b908c440b1d 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -96,7 +96,7 @@ class stock_picking(osv.osv): sale_line_obj = self.pool.get('sale.order.line') if move_line.sale_line_id: sale_line_obj.write(cursor, user, [move_line.sale_line_id.id], {'invoiced':True, - 'line_invoice_id': invoice_line_id, + 'invoice_lines': [(4, invoice_line_id)], }) return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id) @@ -185,7 +185,7 @@ class stock_picking(osv.osv): 'account_analytic_id': account_analytic_id, }, context=context) self.pool.get('sale.order.line').write(cursor, user, [sale_line.id], {'invoiced':True, - 'line_invoice_id': invoice_line_id, + 'invoice_lines': [(6, 0, [invoice_line_id])], }) return result diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index 46a582372ef..41ab5d33900 100755 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -80,7 +80,7 @@ - + From 84785edda96ca93ffdd6d66e81515b2d0d59a5cd Mon Sep 17 00:00:00 2001 From: Launchpad Code Hosting Date: Thu, 5 Aug 2010 04:35:39 +0100 Subject: [PATCH 02/15] Launchpad automatic translations update. bzr revid: codehost@crowberry-20100805033539-d62eaewzq0i4ckb7 --- addons/account/i18n/sr.po | 6 +++--- addons/mrp/i18n/ru.po | 18 +++++++++--------- addons/purchase/i18n/pt_BR.po | 24 +++++++++++++++++------- addons/stock/i18n/nl.po | 2 +- addons/stock_location/i18n/nl.po | 2 +- addons/subscription/i18n/nl.po | 2 +- 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/addons/account/i18n/sr.po b/addons/account/i18n/sr.po index fcdfacc0eba..298efaf2b2d 100644 --- a/addons/account/i18n/sr.po +++ b/addons/account/i18n/sr.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-08-02 20:19+0000\n" -"Last-Translator: Dragan Životić \n" +"PO-Revision-Date: 2010-08-04 13:59+0000\n" +"Last-Translator: Данило Шеган \n" "Language-Team: Serbian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-03 03:41+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/mrp/i18n/ru.po b/addons/mrp/i18n/ru.po index bcfed250324..9128308b79d 100644 --- a/addons/mrp/i18n/ru.po +++ b/addons/mrp/i18n/ru.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.0\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-08-03 08:26+0000\n" -"Last-Translator: mga (Open ERP) \n" +"PO-Revision-Date: 2010-08-04 08:05+0000\n" +"Last-Translator: vrsb \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-04 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: mrp @@ -157,8 +157,8 @@ msgid "" "Number of operation this workcenter can do in parallel. If this workcenter " "represent a team of 5 workers, the capacity per cycle is 5." msgstr "" -"Количество одновременно выполняемых рабочим центром операций. Если рабочиё " -"центр представлен пятью рабочими, этот показатель равен 5" +"Количество одновременно выполняемых участком обработки операций. Если " +"участок обработки представлен пятью рабочими, этот показатель равен 5" #. module: mrp #: wizard_button:product.product.procurement,init,create:0 @@ -181,7 +181,7 @@ msgstr "Кол-во продукции" #. module: mrp #: field:mrp.production,move_lines:0 msgid "Products Consummed" -msgstr "" +msgstr "Израсходовано" #. module: mrp #: field:mrp.workcenter,costs_cycle_account_id:0 @@ -653,7 +653,7 @@ msgstr "" #. module: mrp #: rml:mrp.production.order:0 msgid "WorkCenter" -msgstr "" +msgstr "Участок обработки" #. module: mrp #: field:stock.warehouse.orderpoint,product_min_qty:0 @@ -813,7 +813,7 @@ msgstr "" #. module: mrp #: field:mrp.workcenter,name:0 msgid "Workcenter Name" -msgstr "" +msgstr "Участок обработки" #. module: mrp #: view:mrp.production:0 @@ -847,7 +847,7 @@ msgstr "" #: model:ir.ui.menu,name:mrp.menu_mrp_workcenter_action #: field:mrp.routing,workcenter_lines:0 msgid "Workcenters" -msgstr "" +msgstr "Участки обработки" #. module: mrp #: view:mrp.procurement:0 diff --git a/addons/purchase/i18n/pt_BR.po b/addons/purchase/i18n/pt_BR.po index e6e04e38507..2c07d039a9a 100644 --- a/addons/purchase/i18n/pt_BR.po +++ b/addons/purchase/i18n/pt_BR.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: pt_BR\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-08-03 17:09+0000\n" +"PO-Revision-Date: 2010-08-04 20:16+0000\n" "Last-Translator: Renato Lima - http://www.akretion.com " "\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-04 03:37+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: purchase @@ -26,7 +26,7 @@ msgstr "Faturamento & Pago" #. module: purchase #: model:process.node,note:purchase.process_node_invoiceafterpacking0 msgid "Supplier Invoice pre-generated on receptions for control" -msgstr "" +msgstr "Fatura do fornecedor pré-gerada nos recebimentos para controle" #. module: purchase #: field:purchase.order,location_id:0 @@ -207,7 +207,7 @@ msgstr "" #. module: purchase #: field:purchase.order,origin:0 msgid "Origin" -msgstr "" +msgstr "Origem" #. module: purchase #: model:process.node,name:purchase.process_node_packinglist0 @@ -265,6 +265,12 @@ msgid "" "Manual: no invoice will be pre-generated. The accountant will have to encode " "manually." msgstr "" +"Da Ordem: Uma fatura provisória será gerada com base na ordem de compra. O " +"contador só precisa validar esta fatura para controle.\n" +"Da Seleção da Recepção: Uma fatura provisória será gerada baseada nas " +"recepções validadas.\n" +"Manual: Nenhuma fatura será gerada. O contador deverá codificá-la " +"manualmente." #. module: purchase #: model:process.node,note:purchase.process_node_packinginvoice0 @@ -331,6 +337,7 @@ msgstr "Order Lines" #: model:process.transition,note:purchase.process_transition_confirmingpurchaseorder1 msgid "Confirm Purchase order from Request for quotation without origin" msgstr "" +"Confirmar Ordem de Compra a partir da Requisição de Cotação sem origem" #. module: purchase #: rml:purchase.quotation:0 @@ -401,7 +408,7 @@ msgstr "Lista de Preços" #. module: purchase #: model:process.node,note:purchase.process_node_purchaseorder0 msgid "When controlling invoice from orders" -msgstr "" +msgstr "Quando controlada notas fiscais pelas ordens" #. module: purchase #: constraint:ir.ui.view:0 @@ -411,7 +418,7 @@ msgstr "Invalid XML for View Architecture!" #. module: purchase #: model:process.node,note:purchase.process_node_invoicecontrol0 msgid "Pre-generated supplier invoice to control based on order" -msgstr "" +msgstr "Notas fiscais de entredas pré-geradas em controle baseado na ordem" #. module: purchase #: model:process.transition,name:purchase.process_transition_invoicefrompurchase0 @@ -561,7 +568,7 @@ msgstr "Requisição de Cotação é proposta pelo sistema." #. module: purchase #: model:process.transition,name:purchase.process_transition_packinginvoice0 msgid "Packing Invoice" -msgstr "" +msgstr "Faturar embalagem" #. module: purchase #: model:process.transition,note:purchase.process_transition_invoicefrompackinglist0 @@ -765,6 +772,9 @@ msgid "" "Module for purchase management\n" " Request for quotation, Create Supplier Invoice, Print Order..." msgstr "" +"Módulo para gerenciamento de compra\n" +" Pedido de Cotação, Criação de Fatura de Fornecedor, Impressão de " +"Ordem..." #. module: purchase #: field:purchase.order.line,product_id:0 diff --git a/addons/stock/i18n/nl.po b/addons/stock/i18n/nl.po index fc54cfbf86d..2a7d56ccd36 100644 --- a/addons/stock/i18n/nl.po +++ b/addons/stock/i18n/nl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-04 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: stock diff --git a/addons/stock_location/i18n/nl.po b/addons/stock_location/i18n/nl.po index e47ae6127e2..2e0e7f60503 100644 --- a/addons/stock_location/i18n/nl.po +++ b/addons/stock_location/i18n/nl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-04 03:46+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: stock_location diff --git a/addons/subscription/i18n/nl.po b/addons/subscription/i18n/nl.po index 4279de2c0f5..37a1a713534 100644 --- a/addons/subscription/i18n/nl.po +++ b/addons/subscription/i18n/nl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-08-04 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-08-05 03:35+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: subscription From 187e9ff63c7b9d89a2c0a80b270bb8d05b53a27e Mon Sep 17 00:00:00 2001 From: "PSI(OpenERP)" <> Date: Thu, 5 Aug 2010 10:11:04 +0530 Subject: [PATCH 03/15] [IMP] hr_payroll: Reports improvements and add bank field on payroll advice object bzr revid: mra@mra-laptop-20100805044104-jt6s9irtb1v59fr2 --- addons/hr_payroll/hr_payroll.py | 24 +++++++ addons/hr_payroll/hr_payroll_view.xml | 15 +++-- addons/hr_payroll/report/payroll_register.rml | 20 +++--- addons/hr_payroll/report/payslip.rml | 65 ++++++------------- .../report/report_payroll_advice.rml | 43 ++++++------ 5 files changed, 87 insertions(+), 80 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index a7984d7c7fa..6454c02a04d 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -325,6 +325,17 @@ class payroll_advice(osv.osv): _name = 'hr.payroll.advice' _description = 'Bank Advice Note' + def _get_bank(self, cr, uid, ids, field_name, args, context=None): + res = {} + if context is None: + context = {} + for rec in self.browse(cr, uid, ids, context=context): + if rec.company_id and rec.company_id.partner_id.bank_ids: + res[rec.id] = rec.company_id.partner_id.bank_ids[0].bank.name + else: + res[rec.id] = '' + return res + _columns = { 'register_id':fields.many2one('hr.payroll.register', 'Payroll Register', required=False), 'name':fields.char('Name', size=2048, required=True, readonly=False), @@ -340,6 +351,7 @@ class payroll_advice(osv.osv): 'chaque_nos':fields.char('Chaque Nos', size=256, required=False, readonly=False), 'account_id': fields.many2one('account.account', 'Account', required=True), 'company_id':fields.many2one('res.company', 'Company', required=False), + 'bank': fields.function(_get_bank, method=True, string='Bank', type="char"), } _defaults = { @@ -368,6 +380,18 @@ class payroll_advice(osv.osv): self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True + def onchange_company_id(self, cr, uid, ids, company_id, context=None): + res = {} + if context is None: + context = {} + if company_id: + company = self.pool.get('res.company').browse(cr, uid, company_id, context=context) + res.update({'bank': company.partner_id.bank_ids[0].bank.name}) + return { + 'value':res + } + + payroll_advice() class payroll_advice_line(osv.osv): diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 8f50302d703..2ad028bd752 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -606,7 +606,7 @@ - + @@ -692,11 +692,11 @@ - + company.contribution.select company.contribution search - + @@ -720,7 +720,7 @@ company.contribution form - + - - + + + + + diff --git a/addons/hr_payroll/report/payroll_register.rml b/addons/hr_payroll/report/payroll_register.rml index 13e40b68fe5..10f01c182cd 100644 --- a/addons/hr_payroll/report/payroll_register.rml +++ b/addons/hr_payroll/report/payroll_register.rml @@ -2,7 +2,7 @@ @@ -104,7 +104,7 @@ - + Expanse To @@ -130,7 +130,7 @@ Date - [[o.date]] + [[formatLang(time.strftime('%Y-%m-%d'), date = True)]] @@ -177,22 +177,22 @@ [[ l.employee_id.name ]] - [[l.basic]] + [[formatLang(l.basic)]] - [[l.other_pay]] + [[formatLang(l.other_pay)]] - [[l.allounce]] + [[formatLang(l.allounce)]] - [[l.grows]] + [[formatLang(l.grows)]] - [[l.deduction]] + [[formatLang(l.deduction)]] - [[l.net]] + [[formatLang(l.net)]] @@ -230,7 +230,7 @@ - + For [[company.name]], diff --git a/addons/hr_payroll/report/payslip.rml b/addons/hr_payroll/report/payslip.rml index ede60a9a490..30f20d167c6 100755 --- a/addons/hr_payroll/report/payslip.rml +++ b/addons/hr_payroll/report/payslip.rml @@ -72,15 +72,9 @@ + - - - - - - - @@ -95,15 +89,9 @@ + - - - - - - - @@ -240,18 +228,18 @@ - + - - - - - - + + + + + + - - + + @@ -272,11 +260,11 @@ - + + - [[repeatIn(objects,'o')]] @@ -296,7 +284,7 @@ - + Code @@ -312,7 +300,7 @@ - + Address @@ -322,7 +310,7 @@ - + Email @@ -338,7 +326,7 @@ - + Slip ID @@ -346,12 +334,6 @@ [[ o.number or '' ]] - - Bill No - - - [[ o.move_id and o.move_id.name or '' ]] - PAN No @@ -360,7 +342,7 @@ - + Register @@ -368,17 +350,11 @@ [[ o.register_id and o.register_id.name or '' ]] - - Payment - - - [[ o.payment_id and o.payment_id.name or '' ]] - Designation - [[ o.employee_id.contract_ids and o.employee_id.contract_ids[0].function.name or '' ]] + [[ o.employee_id.contract_ids and o.employee_id.contract_ids[0].job_id.name or '' ]] @@ -515,7 +491,7 @@ - [[repeatIn(get_earnings(o.line_ids),'a') ]][[ a.code or removeParentNode('tr') ]] + [[repeatIn(get_earnings(o.line_ids),'a') ]] [[ a.code or removeParentNode('tr') ]] [[ formatLang(a.total) ]] @@ -669,3 +645,4 @@ + diff --git a/addons/hr_payroll/report/report_payroll_advice.rml b/addons/hr_payroll/report/report_payroll_advice.rml index 00a2d599d0e..d9f8c793a8e 100644 --- a/addons/hr_payroll/report/report_payroll_advice.rml +++ b/addons/hr_payroll/report/report_payroll_advice.rml @@ -64,14 +64,14 @@ - + - + - - + + @@ -81,8 +81,8 @@ - - + + @@ -97,10 +97,10 @@ - - - - + + + + @@ -109,15 +109,15 @@ - - - - + + + + - - + + + - [[repeatIn(objects,'o')]] Payment Advice @@ -132,7 +132,9 @@ - [[ formatLang(o.date,date=True) ]] + + + @@ -147,7 +149,7 @@ - Axis Bank + [[o.bank or 'Bank']] @@ -172,7 +174,7 @@ - [[ o.name ]] for period [[ get_month(o.date)['mname'] ]] + [[ o.name ]] for period [[ get_month(o.date)['mname'] ]] @@ -335,3 +337,4 @@ + From bef2f4f82ade6a7713ab90d89d69452676757db3 Mon Sep 17 00:00:00 2001 From: "p_christ@hol.gr" <> Date: Thu, 5 Aug 2010 10:58:15 +0530 Subject: [PATCH 04/15] [FIX] Project: Task search fix regression bzr revid: mra@mra-laptop-20100805052815-3gum037ihtbp5bp3 --- addons/project/project.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index f0e1ceaaddd..fd839149422 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -335,28 +335,29 @@ class task(osv.osv): _description = "Task" _log_create = True _date_name = "date_start" - + def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): + obj_project = self.pool.get('project.project') for domain in args: if domain[0] == 'project_id' and (not isinstance(domain[2], str)): - id = isinstance(domain[2], list) and int(domain[2][0]) or int(domain[2]) - if id: - if self.pool.get('project.project').read(cr, user, id, ['state'])['state'] == 'template': - args.append(['active', '=', False]) + id = isinstance(domain[2], list) and domain[2][0] or domain[2] + if id and isinstance(id, (long, int)): + if obj_project.read(cr, user, id, ['state'])['state'] == 'template': + args.append(('active', '=', False)) return super(task, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) def _str_get(self, task, level=0, border='***', context=None): return border+' '+(task.user_id and task.user_id.name.upper() or '')+(level and (': L'+str(level)) or '')+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' '+border+'\n'+ \ border[0]+' '+(task.name or '')+'\n'+ \ (task.description or '')+'\n\n' - + # Compute: effective_hours, total_hours, progress def _hours_get(self, cr, uid, ids, field_names, args, context=None): project_obj = self.pool.get('project.project') res = {} cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id IN %s GROUP BY task_id",(tuple(ids),)) hours = dict(cr.fetchall()) - + uom_obj = self.pool.get('product.uom') user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) if user_uom != default_uom: From fa1990b532f9602beee7e955c0a61ab4d9299b66 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 5 Aug 2010 11:09:52 +0530 Subject: [PATCH 05/15] [Fix] stock : Fix the packing report bzr revid: sbh@tinyerp.com-20100805053952-8suzix8brrra4x8s --- addons/stock/report/packing.rml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/stock/report/packing.rml b/addons/stock/report/packing.rml index 3db817996d9..7288615da6d 100644 --- a/addons/stock/report/packing.rml +++ b/addons/stock/report/packing.rml @@ -276,12 +276,11 @@ - [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]] - Non Assigned Products: [[ ( move_lines.state == 'assigned' or move_lines.state == 'done' or move_lines.state == 'confirmed' ) and removeParentNode('para') ]] - [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]] -
- [[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]] + + [[ ([line for line in picking.move_lines if (line.state == 'draft' )]) and 'Non Assigned Products:' or removeParentNode('para') ]] +
+ [[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]] [ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] From 724c4ebb44cdf20db0a925e91b3937fd3b168b8b Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 5 Aug 2010 11:51:57 +0530 Subject: [PATCH 06/15] [REF] stock,delivery :Remove the unused import statemnet, and comment code bzr revid: sbh@tinyerp.com-20100805062157-a6dm6rmqd8nwdqq3 --- addons/delivery/delivery.py | 1 - addons/delivery/stock.py | 2 -- addons/stock/report/report_stock.py | 3 --- addons/stock/report/stock_graph.py | 2 +- addons/stock/wizard/stock_inventory_merge.py | 6 ------ addons/stock/wizard/stock_partial_move.py | 10 ++-------- 6 files changed, 3 insertions(+), 21 deletions(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index f1fadd81bd4..6501e0aa230 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -20,7 +20,6 @@ ############################################################################## import time -import netsvc from osv import fields,osv from tools.translate import _ diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index 6193a6299a1..76897d46e58 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -19,10 +19,8 @@ # ############################################################################## -import netsvc from osv import fields,osv from tools.translate import _ -import tools import decimal_precision as dp diff --git a/addons/stock/report/report_stock.py b/addons/stock/report/report_stock.py index 81e2bb125fd..5ea8c83c602 100644 --- a/addons/stock/report/report_stock.py +++ b/addons/stock/report/report_stock.py @@ -24,9 +24,6 @@ from tools.translate import _ import tools from tools.sql import drop_view_if_exists -# -# Check if it works with UoM ??? -# class stock_report_prodlots(osv.osv): _name = "stock.report.prodlots" _description = "Stock report by production lots" diff --git a/addons/stock/report/stock_graph.py b/addons/stock/report/stock_graph.py index d20baa08d58..bb97119c299 100644 --- a/addons/stock/report/stock_graph.py +++ b/addons/stock/report/stock_graph.py @@ -24,7 +24,7 @@ import time from report.misc import choice_colors # -# dRAw a graph for stocks +# Draw a graph for stocks # class stock_graph(object): def __init__(self, io): diff --git a/addons/stock/wizard/stock_inventory_merge.py b/addons/stock/wizard/stock_inventory_merge.py index 30450e4d253..b08f0ca79c8 100644 --- a/addons/stock/wizard/stock_inventory_merge.py +++ b/addons/stock/wizard/stock_inventory_merge.py @@ -20,13 +20,7 @@ ############################################################################## from osv import fields, osv -from service import web_services -from tools.misc import UpdateableStr, UpdateableDict from tools.translate import _ -import netsvc -import pooler -import time -import wizard class stock_inventory_merge(osv.osv_memory): _name = "stock.inventory.merge" diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py index 01e8a712dca..f3af091d58b 100644 --- a/addons/stock/wizard/stock_partial_move.py +++ b/addons/stock/wizard/stock_partial_move.py @@ -186,8 +186,7 @@ class stock_partial_move(osv.osv_memory): res['move%s_product_qty'%(m.id)] = m.product_qty if 'move%s_product_uom'%(m.id) in fields: res['move%s_product_uom'%(m.id)] = m.product_uom.id - - if (m.picking_id.type == 'out') and (m.product_id.cost_method == 'average'): + if (m.picking_id.type == 'out') and (m.product_id.cost_method == 'average') and 'sale_id' in m.picking_id._columns.keys(): price = 0 if hasattr(m, 'sale_line_id') and m.sale_line_id: price = m.sale_line_id.price_unit @@ -201,7 +200,7 @@ class stock_partial_move(osv.osv_memory): if 'move%s_product_currency'%(m.id) in fields: res['move%s_product_currency'%(m.id)] = currency - if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): + if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average') and 'purchase_id' in m.picking_id._columns.keys(): price = 0 if hasattr(m, 'purchase_line_id') and m.purchase_line_id: price = m.purchase_line_id.price_unit @@ -227,11 +226,6 @@ class stock_partial_move(osv.osv_memory): """ rec_id = context and context.get('active_id', False) - #tracking_lot = context.get('tracking_lot', False) - #if tracking_lot: - # tracking = self.pool.get('stock.tracking') - # tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot) - # context ['tracking_lot'] = tracking_lot move_obj = self.pool.get('stock.move') move_ids = context.get('active_ids', False) partial = self.browse(cr, uid, ids[0], context) From 90fd4877f711c14d822ff51add54805eebf35f8c Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 5 Aug 2010 12:18:18 +0530 Subject: [PATCH 07/15] [REF] purchase : Remove the comment code bzr revid: sbh@tinyerp.com-20100805064818-0vnoc9uw3vxa8scz --- addons/purchase/purchase.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e7f5473b42a..afefebd4bb9 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -535,7 +535,6 @@ class purchase_order(osv.osv): 'fiscal_position': porder.fiscal_position and porder.fiscal_position.id or False, }) else: - #order_infos['name'] += ', %s' % porder.name if porder.notes: order_infos['notes'] = (order_infos['notes'] or '') + ('\n%s' % (porder.notes,)) if porder.origin: From 1cf2f0aeb5e6c4a5136120f95a8e2d58ee54d9c1 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 5 Aug 2010 12:50:23 +0530 Subject: [PATCH 08/15] [IMP] Project: improve code bzr revid: mra@mra-laptop-20100805072023-lhqjd5eb6g38d6dn --- addons/project/project.py | 149 +++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 83 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index fd839149422..211fc78a6a6 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -29,12 +29,12 @@ from osv import fields, osv class project_task_type(osv.osv): _name = 'project.task.type' _description = 'Task Stage' + _order = 'sequence' _columns = { 'name': fields.char('Stage Name', required=True, size=64, translate=True), 'description': fields.text('Description'), 'sequence': fields.integer('Sequence'), } - _order = 'sequence' _defaults = { 'sequence': 1 @@ -55,8 +55,7 @@ class project(osv.osv): LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id LEFT JOIN project_user_rel rel ON rel.project_id = project.analytic_account_id WHERE (account.user_id = %s or rel.uid = %s)"""%(user, user)) - res = cr.fetchall() - return [(r[0]) for r in res] + return [(r[0]) for r in cr.fetchall()] return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) @@ -66,10 +65,6 @@ class project(osv.osv): res[m.id] = (m.parent_id and (m.parent_id.name + '/') or '') + m.name return res - def check_recursion(self, cursor, user, ids, parent=None): - return super(project, self).check_recursion(cursor, user, ids, - parent=parent) - def onchange_partner_id(self, cr, uid, ids, part=False, context=None): partner_obj = self.pool.get('res.partner') if not part: @@ -80,30 +75,29 @@ class project(osv.osv): return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}} def get_all_child_projects(self, cr, uid, ids, context=None): + # Calculate child project for Given project id => For progress rate + planned time + Time spent cr.execute('''select prpc.id as id from account_analytic_account as p -join account_analytic_account as c on p.id = c.parent_id -join project_project as prp on prp.analytic_account_id = p.id -join project_project as prpc on prpc.analytic_account_id = c.id -where prp.id in %s''',(tuple(ids),)) + join account_analytic_account as c on p.id = c.parent_id + join project_project as prp on prp.analytic_account_id = p.id + join project_project as prpc on prpc.analytic_account_id = c.id + where prp.id in %s''',(tuple(ids),)) child_ids = cr.fetchall() if child_ids: - child_ids = [x[0] for x in child_ids] - child_ids = self.get_all_child_projects(cr, uid, child_ids) + child_ids = [x[0] for x in child_ids] + child_ids = self.get_all_child_projects(cr, uid, child_ids) + return ids + child_ids - return ids+child_ids - def _get_user_and_default_uom_ids(self, cr, uid): users_obj = self.pool.get('res.users') model_data_obj = self.pool.get('ir.model.data') - model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour') default_uom = user_uom = model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id'] obj_tm = users_obj.browse(cr, uid, uid).company_id.project_time_mode_id if obj_tm: user_uom = obj_tm.id return user_uom, default_uom - + def _progress_rate(self, cr, uid, ids, names, arg, context=None): res = {}.fromkeys(ids, 0.0) progress = {} @@ -138,19 +132,19 @@ where prp.id in %s''',(tuple(ids),)) p = tocompute.pop() for i in range(3): s[i] += progress.get(p, (0.0, 0.0, 0.0))[i] - - uom_obj = self.pool.get('product.uom') + + uom_obj = self.pool.get('product.uom') user_uom, def_uom = self._get_user_and_default_uom_ids(cr, uid) if user_uom != def_uom: s[0] = uom_obj._compute_qty(cr, uid, user_uom, s[0], def_uom) s[1] = uom_obj._compute_qty(cr, uid, user_uom, s[1], def_uom) s[2] = uom_obj._compute_qty(cr, uid, user_uom, s[2], def_uom) - + if project.state == 'close': progress_rate = 100.0 else: progress_rate = s[1] and round(min(100.0 * s[2] / s[1], 99.99), 2) - + res[project.id] = { 'planned_hours': s[0], 'effective_hours': s[2], @@ -164,7 +158,7 @@ where prp.id in %s''',(tuple(ids),)) if proj.tasks: raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.')) return super(project, self).unlink(cr, uid, ids, *args, **kwargs) - + _columns = { 'complete_name': fields.function(_complete_name, method=True, string="Project Name", type='char', size=250), 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the project without removing it."), @@ -253,21 +247,20 @@ where prp.id in %s''',(tuple(ids),)) default['name'] = proj.name+_(' (copy)') res = super(project, self).copy(cr, uid, id, default, context) - task_ids = task_obj.search(cr, uid, [('project_id','=', res), ('active','=',True)]) - tasks = task_obj.browse(cr, uid, task_ids) - for task in tasks: - date_deadline = None - if task.date_start: - ds = date(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3]) - if task.date_deadline: - dd = date(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3]) - diff = dd-ds - date_deadline = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S') - task_obj.write(cr, uid, task.id, {'active':True, - 'date_start': False, - 'date_end': False, - 'date_deadline':date_deadline, - }) +# task_ids = task_obj.search(cr, uid, [('project_id','=', res), ('active','=',True)]) +# tasks = task_obj.browse(cr, uid, task_ids) +# for task in tasks: +# date_deadline = None +# if task.date_start: +# ds = date(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3]) +# if task.date_deadline: +# dd = date(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3]) +# diff = dd-ds +# date_deadline = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S') +# task_obj.write(cr, uid, task.id, {'date_start': False, +# 'date_end': False, +# 'date_deadline':date_deadline, +# }) return res @@ -365,7 +358,7 @@ class task(osv.osv): if hours.get(task.id, False): dur_in_user_uom = uom_obj._compute_qty(cr, uid, default_uom, hours.get(task.id, 0.0), user_uom) hours[task.id] = dur_in_user_uom - + for task in self.browse(cr, uid, ids, context=context): res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': task.remaining_hours + hours.get(task.id, 0.0)} res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours @@ -413,7 +406,7 @@ class task(osv.osv): if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res - + _columns = { 'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."), 'name': fields.char('Task Summary', size=128, required=True), @@ -461,7 +454,7 @@ class task(osv.osv): _order = "sequence, priority, date_start, id" _constraints = [ - (_check_dates, 'Error! task start-date must be lower then task end-date.', ['date_start', 'date_end']) + (_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']) ] # # Override view according to the company definition @@ -493,7 +486,6 @@ class task(osv.osv): for f in res['fields']: if 'Hours' in res['fields'][f]['string']: res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm) - return res def do_close(self, cr, uid, ids, *args): @@ -602,7 +594,6 @@ class task(osv.osv): self.write(cr, uid, ids, {'state': 'draft'}) return True - def do_pending(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'pending'}) for (id, name) in self.name_get(cr, uid, ids): @@ -636,7 +627,7 @@ task() class project_work(osv.osv): _name = "project.task.work" - _description = "Task Work" + _description = "Project Task Work" _columns = { 'name': fields.char('Work summary', size=128), 'date': fields.datetime('Date'), @@ -652,34 +643,36 @@ class project_work(osv.osv): } _order = "date desc" - + def create(self, cr, uid, vals, *args, **kwargs): - if (not 'task_id' in vals) or (not 'hours' in vals): - return super(project_work,self).create(cr, uid, vals, *args, **kwargs) - if not vals['hours']: - vals['hours'] = 0.00 - project_obj = self.pool.get('project.project') uom_obj = self.pool.get('product.uom') + + if (not 'task_id' in vals) or (not 'hours' in vals): + return super(project_work, self).create(cr, uid, vals, *args, **kwargs) + if not vals['hours']: + vals['hours'] = 0.00 + user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) duration = vals['hours'] - + if user_uom != default_uom: duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom) cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (duration, vals['task_id'])) return super(project_work,self).create(cr, uid, vals, *args, **kwargs) def write(self, cr, uid, ids, vals, context=None): + project_obj = self.pool.get('project.project') + uom_obj = self.pool.get('product.uom') + if context is None: context = {} if not vals['hours']: - vals['hours'] = 0.00 - - project_obj = self.pool.get('project.project') - uom_obj = self.pool.get('product.uom') - user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) + vals['hours'] = 0.00 + + user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) duration = vals['hours'] - + if user_uom == default_uom: for work in self.browse(cr, uid, ids, context): cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, work.hours, work.task_id.id)) @@ -688,14 +681,14 @@ class project_work(osv.osv): duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom) del_work = uom_obj._compute_qty(cr, uid, default_uom, work.hours, user_uom) cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, del_work, work.task_id.id)) - + return super(project_work,self).write(cr, uid, ids, vals, context) def unlink(self, cr, uid, ids, *args, **kwargs): context = kwargs.get('context', {}) project_obj = self.pool.get('project.project') - user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) - + user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid) + if user_uom == default_uom: for work in self.browse(cr, uid, ids, context): cr.execute('update project_task set remaining_hours=remaining_hours + %s where id=%s', (work.hours, work.task_id.id)) @@ -710,64 +703,54 @@ project_work() class config_compute_remaining(osv.osv_memory): _name='config.compute.remaining' - def _get_remaining(self,cr, uid, ctx): - task_obj = self.pool.get('project.task') - if 'active_id' in ctx: - return task_obj.browse(cr, uid, ctx['active_id'], context=ctx).remaining_hours + def _get_remaining(self,cr, uid, context=None): + if context and 'active_id' in context: + return self.pool.get('project.task').browse(cr, uid, ctx['active_id'], context=context).remaining_hours return False _columns = { 'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Put here the remaining hours required to close the task."), } - def _get_analytic_account(self, cr, uid, context={}): - if context.get('account_id', False): - return context.get('account_id') - return False - - _defaults = { - 'account_id' : _get_analytic_account, - } - _defaults = { 'remaining_hours': _get_remaining } - + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): users_obj = self.pool.get('res.users') obj_tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id tm = obj_tm and obj_tm.name or 'Hours' - + res = super(config_compute_remaining, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu) - + if tm in ['Hours','Hour']: return res - + eview = etree.fromstring(res['arch']) - + def _check_rec(eview): if eview.attrib.get('widget','') == 'float_time': eview.set('widget','float') for child in eview: _check_rec(child) return True - + _check_rec(eview) - + res['arch'] = etree.tostring(eview) - + for f in res['fields']: if 'Hours' in res['fields'][f]['string']: res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm) - return res + def compute_hours(self, cr, uid, ids, context=None): if context is None: context = {} task_obj = self.pool.get('project.task') request = self.pool.get('res.request') if 'active_id' in context: - remaining_hrs=self.browse(cr,uid,ids)[0].remaining_hours + remaining_hrs = self.browse(cr,uid,ids)[0].remaining_hours task_obj.write(cr,uid,context['active_id'],{'remaining_hours':remaining_hrs}) if context.get('button_reactivate', False): tasks = task_obj.browse(cr, uid, [context['active_id']], context=context) @@ -787,7 +770,7 @@ class config_compute_remaining(osv.osv_memory): return { 'type': 'ir.actions.act_window_close', } - + config_compute_remaining() class message(osv.osv): From d7744b204fe8a0ef62dce6b1c49e8efafe41e529 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Thu, 5 Aug 2010 14:34:12 +0530 Subject: [PATCH 09/15] [REMOVE] configuration wizard : profile_bookstore option from module list bzr revid: vir@tinyerp.com-20100805090412-0dp02g6ox0bz05i3 --- addons/base_setup/base_setup_installer.xml | 21 ++++++++++----------- addons/base_setup/installer.py | 4 ---- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml index 3af1a070104..08a85d32436 100644 --- a/addons/base_setup/base_setup_installer.xml +++ b/addons/base_setup/base_setup_installer.xml @@ -23,18 +23,17 @@ Install Generic Modules - - - - - - - + + + + + + + - - - - + + + diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py index 3e340ca8c6f..9c02c5f20c1 100644 --- a/addons/base_setup/installer.py +++ b/addons/base_setup/installer.py @@ -86,10 +86,6 @@ class base_setup_installer(osv.osv_memory): help="Installs a preselected set of OpenERP " "applications selected to help you manage your auctions " "as well as the business processes around them."), - 'profile_bookstore':fields.boolean('Book Stores', - help="Installs a preselected set of OpenERP " - "applications which will help you manage your book store " - "or your library."), } _defaults = { 'crm': True, From c4f3dc085d65a102c2c0824b3a0d2d8109efec2a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 5 Aug 2010 11:19:09 +0200 Subject: [PATCH 10/15] [IMP] mail_gateway: improve email headers detection for mail user agents that do not set the References but just the In-Reply-To headers bzr revid: odo@openerp.com-20100805091909-cv91l3380kkpr4a7 --- addons/mail_gateway/mail_gateway.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index ef36be3a3ef..81050b1dac9 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -234,16 +234,16 @@ class mailgate_tool(osv.osv_memory): msg_pool = self.pool.get('mailgate.message') for res_id in res_ids: msg_data = { - 'name': msg.get('subject', 'No subject'), - 'date': msg.get('date') , - 'description': msg.get('body', msg.get('from')), + 'name': msg.get('subject', 'No subject'), + 'date': msg.get('date'), + 'description': msg.get('body', msg.get('from')), 'history': True, - 'res_model': model, - 'email_cc': msg.get('cc'), - 'email_from': msg.get('from'), + 'res_model': model, + 'email_cc': msg.get('cc'), + 'email_from': msg.get('from'), 'email_to': msg.get('to'), - 'message_id': msg.get('message-id'), - 'references': msg.get('references'), + 'message_id': msg.get('message-id'), + 'references': msg.get('references') or msg.get('in-reply-to'), 'res_id': res_id, 'user_id': uid, 'attachment_ids': [(6, 0, attach)] @@ -380,6 +380,9 @@ class mailgate_tool(osv.osv_memory): if 'References' in fields: msg['references'] = msg_txt.get('References') + if 'In-Reply-To' in fields: + msg['in-reply-to'] = msg_txt.get('In-Reply-To') + if 'X-Priority' in fields: msg['priority'] = msg_txt.get('X-Priority', '3 (Normal)').split(' ')[0] @@ -425,12 +428,12 @@ class mailgate_tool(osv.osv_memory): res_ids = [] attachment_ids = [] new_res_id = False - if msg.get('references'): - references = msg.get('references') + if msg.get('references') or msg.get('in-reply-to'): + references = msg.get('references') or msg.get('in-reply-to') if '\r\n' in references: - references = msg.get('references').split('\r\n') + references = references.split('\r\n') else: - references = msg.get('references').split(' ') + references = references.split(' ') for ref in references: ref = ref.strip() res_id = tools.misc.reference_re.search(ref) @@ -464,7 +467,7 @@ class mailgate_tool(osv.osv_memory): email_from = msg.get('from'), email_cc = msg.get('cc'), message_id = msg.get('message-id'), - references = msg.get('references', False), + references = msg.get('references', False) or msg.get('in-reply-to', False), attach = attachments.items(), context = context) else: From 80e39cbe2e5a30020775993a34ab7c5b35fb8518 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 5 Aug 2010 15:24:18 +0530 Subject: [PATCH 11/15] [FIX] Project: rename ctx to context bzr revid: mra@mra-laptop-20100805095418-4votyplo006tdb8s --- addons/project/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 211fc78a6a6..7be2956bed0 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -705,7 +705,7 @@ class config_compute_remaining(osv.osv_memory): def _get_remaining(self,cr, uid, context=None): if context and 'active_id' in context: - return self.pool.get('project.task').browse(cr, uid, ctx['active_id'], context=context).remaining_hours + return self.pool.get('project.task').browse(cr, uid, context['active_id'], context=context).remaining_hours return False _columns = { From 06145300d218a1f996c3f68da488c8074b672c49 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 5 Aug 2010 15:45:50 +0530 Subject: [PATCH 12/15] [FIX]: base_contact: Changed size of field of contact and job table, made compatible with that of partner address lp bug: https://launchpad.net/bugs/605640 fixed bzr revid: rpa@tinyerp.com-20100805101550-jzcssnf0z4kictxy --- addons/base_contact/base_contact.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 848bed39783..85a2241aaa0 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -45,9 +45,9 @@ class res_partner_contact(osv.osv): return res _columns = { - 'name': fields.char('Last Name', size=30, required=True), - 'first_name': fields.char('First Name', size=30), - 'mobile': fields.char('Mobile', size=30), + 'name': fields.char('Last Name', size=64, required=True), + 'first_name': fields.char('First Name', size=64), + 'mobile': fields.char('Mobile', size=64), 'title': fields.many2one('res.partner.title','Title'), 'website': fields.char('Website', size=120), 'lang_id': fields.many2one('res.lang', 'Language'), @@ -203,7 +203,7 @@ class res_partner_job(osv.osv): 'address_id': fields.many2one('res.partner.address', 'Address', \ help='Address which is linked to the Partner'), # TO Correct: domain=[('partner_id', '=', name)] 'contact_id': fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'), - 'function': fields.char('Partner Function', size=34, help="Function of this contact with this partner"), + 'function': fields.char('Partner Function', size=64, help="Function of this contact with this partner"), 'sequence_contact': fields.integer('Contact Seq.',help='Order of\ importance of this address in the list of addresses of the linked contact'), 'sequence_partner': fields.integer('Partner Seq.',help='Order of importance\ From c5d49c63f4579d291b1954d34f31f22d64b4bbf2 Mon Sep 17 00:00:00 2001 From: "JAM (OpenERP)" <> Date: Thu, 5 Aug 2010 16:08:45 +0530 Subject: [PATCH 13/15] [IMP] outlook: improvement bzr revid: hmo@tinyerp.com-20100805103845-fiiiavbohbka01pl --- addons/outlook/__openerp__.py | 6 +- addons/outlook/plugin/dialogs/dialog_map.py | 2 +- .../plugin/dialogs/resources/OpenERP_Logo.bmp | Bin 0 -> 80062 bytes .../plugin/dialogs/resources/dialogs.py | 6 +- .../plugin/dialogs/resources/dialogs.rc | 28 ++--- addons/outlook/plugin/eml.py | 5 +- addons/outlook/plugin/tiny_xmlrpc.py | 111 ++++++++++-------- 7 files changed, 85 insertions(+), 73 deletions(-) create mode 100755 addons/outlook/plugin/dialogs/resources/OpenERP_Logo.bmp diff --git a/addons/outlook/__openerp__.py b/addons/outlook/__openerp__.py index b59f158e5e0..7a6d56b9e59 100644 --- a/addons/outlook/__openerp__.py +++ b/addons/outlook/__openerp__.py @@ -23,15 +23,15 @@ "version" : "1.0", "author" : "OpenERP SA", "website" : "http://www.openerp.com/", - "depends" : ["base"], + "depends" : ["base", "mail_gateway"], "category" : "Generic Modules/Outlook interface", "description": ''' This module provide the Outlook plug-in. Outlook plug-in allows you to select an object that you’d like to add to your email and its attachments from MS Outlook. You can select a partner, a task, - a project, an analytical account, or any other object and attach selected - mail as .eml file in attachment of selected record. + a project, an analytical account, or any other object and Archived selected + mail in mailgate.messages with attachments. ''', "init_xml" : [], diff --git a/addons/outlook/plugin/dialogs/dialog_map.py b/addons/outlook/plugin/dialogs/dialog_map.py index 2cb9477d2a8..98dcc6baa2c 100755 --- a/addons/outlook/plugin/dialogs/dialog_map.py +++ b/addons/outlook/plugin/dialogs/dialog_map.py @@ -711,7 +711,7 @@ def SearchObjectsForText(btnProcessor,*args): search_txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0]) if not search_txt: - win32ui.MessageBox("Enter text to search for", "", flag_info) + win32ui.MessageBox("Enter text to search for", "Archive to OpenERP", flag_info) return # Get titles from list obj_titles=[] diff --git a/addons/outlook/plugin/dialogs/resources/OpenERP_Logo.bmp b/addons/outlook/plugin/dialogs/resources/OpenERP_Logo.bmp new file mode 100755 index 0000000000000000000000000000000000000000..c8bb6091839f35a092455f2e783608d725e9c470 GIT binary patch literal 80062 zcmeI5cbpVun#bLo^WJT8b$1aakpx7-GAKbM2%;z;iV{>%K|xIHu8Rp1%8Hm!Frt6~ za|Bc{Cs34~?w-s9W(F|a-tFGqKlgp!r~93ns_N?Mo}Pi>dOk(-)?06Q-lyvQ)sx=0 zh8(-G-&YQhzrOs-=ih8jNAUkw4)`U%2OMy1{JJ@b|CBWB${jflIP%XuyVpKk*QZ~MWA5ClB{$Y^3anH{nz$5xsJW6k z4&*q{MjYq>IKs&9zN5CFdlVcwBtNQ0m%>Qb9?^|2Hnb66a?R#AkmEpj4s;A0dGVQ@ z3L;$!qn!(4hZIER$d6usO-=Zr=1S%`kmEobaiC-1$ez00BS)7VQV{D>5aAan5j4q< zO+KZvjrfvlHphV+2f}lpW8etmnLe$ub6%u#0Y@{AAfALDYOZ9C133<~5eGU9jx4{e zCa-I=Jc4~h1e3hTu9}?RI>&(=2lg@tIt-3%d%v-3_gLrrXlG+0>0BTQOeAl3VCgd@>yOBbj#?#DMNH?$lF z_Hhn$FdX@>-Mi0g5k(@ll1_QimCJL{Xg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sGP0* zJ{CBl)+=bX&1Ri`SA%q9`(lX(jyx}))5Z~P0;lZl%W90bMbr~LSZE6(3>+L~6T`_T zSDbTB<%RRB&p)qn>Qvc@qqsO$AUkw4n^y=$!63q=)eqKn(2z4PLzCs8K42KfFH0;u zTV`QN#aM_@Jz061&qqU8b7^m+K0tbEGc|z{1ddP6r~F^(cS*?zqVh}Sl4zuqp|C+Cy*-|>={G6(ZBNRC!qnwvOXOJCxI!l2ZyZR zH``~JOU4@FDATQHbi$;H$JW#%s<>#%ow_){TL`xz(*Pd`aome#N<*Tl&c>@$kng*}ktuwwkg?1zqjhrl*A3Sn*Dw)Y#^ zDm^Ve{y#5_jzge2xAWE|HxlV!V?*=-!U5@eOS94!c_;euhlICM(dogpoMb5wvkN6F zICu%8ntGA5^02nPk&oYf%MKw-V%U*Kv>W}1cs;szQg9WV zl)MRXW1|Y~-2)o1Qv!>@1iP-{-fknZv276`$7Dm|aQWI?G_>**93euC?y^1*9Rf-# z(R3MX8LQ*U;Ydy<%5fmaf!1;$ha;`!U@PA<1jk;YbcgavaEUptT%0;Qs*V CdP', ':', '?', '"', '|', '\t', '\n'] - attachments_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\attachments\\") + mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\") + attachments_folder_path = mails_folder_path + "\\attachments\\" if not os.path.exists(attachments_folder_path): os.makedirs(attachments_folder_path) for i in xrange(1, attachments.Count+1): @@ -62,7 +63,7 @@ def generateEML(mail): print mail.lastErrorText() sys.exit() - mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\") + if not os.path.exists(mails_folder_path): os.makedirs(mails_folder_path) for c in ls: diff --git a/addons/outlook/plugin/tiny_xmlrpc.py b/addons/outlook/plugin/tiny_xmlrpc.py index b5153ee88cc..a6ac9081307 100755 --- a/addons/outlook/plugin/tiny_xmlrpc.py +++ b/addons/outlook/plugin/tiny_xmlrpc.py @@ -26,11 +26,11 @@ import os import pythoncom import time from manager import ustr - waittime = 10 wait_count = 0 wait_limit = 12 - +import binascii +import base64 def execute(connector, method, *args): global wait_count res = False @@ -119,7 +119,7 @@ class XMLRpcConn(object): def InsertObj(self, obj_title,obj_name,image_path): self._obj_list=list(self._obj_list) - self._obj_list.append((obj_title,obj_name,ustr(image_path).encode('iso-8859-1'))) + self._obj_list.append((obj_title,obj_name,ustr(image_path))) self._obj_list.sort(reverse=True) def DeleteObject(self,sel_text): @@ -133,46 +133,53 @@ class XMLRpcConn(object): import win32ui, win32con conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object') import eml - msg = "" - ext_msg = "" + new_msg = files = ext_msg ="" eml_path=eml.generateEML(mail) att_name = ustr(eml_path.split('\\')[-1]) - cnt=1 flag=False - for rec in recs: #[('res.partner', 3, 'Agrolait')] - cnt+=1 - obj = rec[0] - obj_id = rec[1] - ids=execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','search',[('res_id','=',obj_id),('name','=',att_name)]) - object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)]) - object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name'] - sub = ustr(mail.Subject) - if ids: - name=execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',obj_id,['name'])['name'] - ext_msg+=""" - File "{0}.eml" is already archived to {1} "{2}" . -""".format(sub,object_name,name) - continue - if len(sub) > 60: - l = 60 - len(sub) - sub = sub[0:l] - res={} - res['res_model'] = obj - content = "".join(open(eml_path,"r").readlines()).encode('base64') - res['name'] = att_name - res['datas_fname'] = sub+".eml" - res['datas'] = content - res['res_id'] = obj_id - execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res) - msg+=""" - File "{0}.eml" archived to {1} "{2}". -""".format(sub,object_name,str(rec[2])) - flag=True - if flag: - t = "Mail archived to OpenERP.\nArchive Summary : \n" - if ext_msg != "" : - t+="\nAlready Attached Documents : \n"+ext_msg +"\n" - t+="Newly Attachment Documents:\n"+msg - win32ui.MessageBox(t,"Archive To OpenERP",win32con.MB_ICONINFORMATION) + attachments=mail.Attachments + for rec in recs: #[('res.partner', 3, 'Agrolait')] + model = rec[0] + res_id = rec[1] + + object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)]) + object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name'] + + + #Reading the Object ir.model Name + + ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)]) + if ext_ids: + name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name'] + ext_msg += """This mail is already archived to {1} '{2}'. +""".format(object_name,name) + continue + + msg = { + 'subject':mail.Subject, + 'date':str(mail.ReceivedTime), + 'body':mail.Body, + 'cc':mail.CC, + 'from':mail.SenderEmailAddress, + 'to':mail.To, + 'message-id':str(mail.EntryID),## we are use Entry_Id as a MessageID Because MessageID is not provided by Outlook API, http://msdn.microsoft.com/en-us/library/bb176688%28v=office.12%29.aspx + 'references':False, + } + result = {} + if attachments: + result = self.MakeAttachment([rec], mail) + + attachment_ids = result.get(model, {}).get(res_id, []) + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids) + + new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2])) + flag = True + + if flag: + t = ext_msg + t += """Mail archived Successfully with attachments.\n"""+new_msg + win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION) return flag def IsCRMInstalled(self): @@ -189,7 +196,7 @@ class XMLRpcConn(object): obj_list.append((-999, ustr(''))) for id in ids: object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0] - obj_list.append((object['id'], ustr(object['name']).encode('iso-8859-1'))) + obj_list.append((object['id'], ustr(object['name']))) return obj_list def GetObjectItems(self, search_list=[], search_text=''): @@ -203,17 +210,17 @@ class XMLRpcConn(object): ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))]) recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city']) for rec in recs: - name = ustr(rec['name']).encode('iso-8859-1') + name = ustr(rec['name']) if rec['street']: - name += ', ' + ustr(rec['street']).encode('iso-8859-1') + name += ', ' + ustr(rec['street']) if rec['city']: - name += ', ' + ustr(rec['city']).encode('iso-8859-1') + name += ', ' + ustr(rec['city']) res.append((obj,rec['id'],name,object_name)) else: ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))]) recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name']) for rec in recs: - name = ustr(rec['name']).encode('iso-8859-1') + name = ustr(rec['name']) res.append((obj,rec['id'],name,object_name)) return res @@ -247,17 +254,22 @@ class XMLRpcConn(object): def MakeAttachment(self, recs, mail): attachments = mail.Attachments + result = {} conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\attachments\\") if not os.path.exists(att_folder_path): os.makedirs(att_folder_path) for rec in recs: #[('res.partner', 3, 'Agrolait')] + obj = rec[0] obj_id = rec[1] res={} res['res_model'] = obj + attachment_ids = [] + if obj not in result: + result[obj] = {} for i in xrange(1, attachments.Count+1): - fn = ustr(attachments[i].FileName).encode('iso-8859-1') + fn = ustr(attachments[i].FileName) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') @@ -271,7 +283,10 @@ class XMLRpcConn(object): res['datas_fname'] = ustr(fn) res['datas'] = content res['res_id'] = obj_id - execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res) + id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res) + attachment_ids.append(id) + result[obj].update({obj_id: attachment_ids}) + return result def CreateContact(self, sel=None, res=None): res=eval(str(res)) @@ -345,7 +360,7 @@ class XMLRpcConn(object): state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', []) for state_id in state_ids: obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0] - state_list.append((obj['id'], ustr(obj['name']).encode('iso-8859-1'))) + state_list.append((obj['id'], ustr(obj['name']))) return state_list def GetAllCountry(self): @@ -356,5 +371,5 @@ class XMLRpcConn(object): country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', []) for country_id in country_ids: obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0] - country_list.append((obj['id'], ustr(obj['name']).encode('iso-8859-1'))) + country_list.append((obj['id'], ustr(obj['name']))) return country_list From 86c6ecb5b21393f79cfdd006b9ce40e4be9b69e3 Mon Sep 17 00:00:00 2001 From: vra Date: Thu, 5 Aug 2010 16:24:03 +0530 Subject: [PATCH 14/15] [FIX] account: added notification on absence of invoice sequence number bzr revid: vra@tinyerp.com-20100805105403-j7ipqdt6zjfao1k7 --- addons/account/invoice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 1816f4c31bf..d40d4037c97 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -942,6 +942,9 @@ class account_invoice(osv.osv): number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id', {'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id}) else: number = self.pool.get('ir.sequence').get(cr, uid, 'account.invoice.' + invtype) + + if not number: + raise osv.except_osv(_('Warning !'), _('There is no active invoice sequence defined for the journal !')) if invtype in ('in_invoice', 'in_refund'): ref = reference From 183f7ca6850769e492020c481d21d11da8d03b49 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 5 Aug 2010 16:53:26 +0530 Subject: [PATCH 15/15] [IMP] purchase_requisition: Remove the unused import statement bzr revid: sbh@tinyerp.com-20100805112326-4w04x63xu943uwlm --- addons/claim_from_delivery/__init__.py | 2 +- addons/purchase_requisition/__openerp__.py | 2 +- addons/purchase_requisition/purchase_requisition.py | 4 +--- .../wizard/purchase_requisition_partner.py | 3 --- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/claim_from_delivery/__init__.py b/addons/claim_from_delivery/__init__.py index 801c814fdf9..6c1b79535b5 100644 --- a/addons/claim_from_delivery/__init__.py +++ b/addons/claim_from_delivery/__init__.py @@ -1,7 +1,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). +# 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 diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index f4c8942bf47..841f8ed318b 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -1,7 +1,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). +# 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 diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 532c9918b60..37a2aaafd3a 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify @@ -23,8 +23,6 @@ import time from osv import fields,osv -from osv import orm -import netsvc from tools.translate import _ class purchase_requisition(osv.osv): diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py index c82dfdb3bd2..56e56799700 100644 --- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py +++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py @@ -23,9 +23,6 @@ import time from mx import DateTime from osv import fields, osv -from service import web_services -import netsvc -import pooler from osv.orm import browse_record, browse_null class purchase_requisition_partner(osv.osv_memory):