From 7b9668516703d4d9be090f276be520f665f3d00a Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 19 Aug 2008 21:26:29 +0200 Subject: [PATCH] Modifications on properties in views bzr revid: fp@tinyerp.com-20080819192629-1nu8lwr8x1xq8o2t --- addons/account/invoice.py | 3 +- addons/account/partner.py | 14 +++++--- addons/account/partner_view.xml | 27 ++++++++++++++-- addons/account/product.py | 4 --- addons/account/product_view.xml | 54 +++++++++++++++++++++++++++++-- addons/delivery/__terp__.py | 2 +- addons/delivery/partner.py | 1 - addons/mrp/wizard/schedulers.py | 3 +- addons/product/__terp__.py | 3 +- addons/product/partner.py | 1 - addons/product/product_view.xml | 5 +-- addons/purchase/__terp__.py | 3 +- addons/purchase/partner.py | 1 - addons/purchase/purchase.py | 16 +++++++++ addons/report_sale/report_sale.py | 9 ------ addons/stock/__terp__.py | 11 ++++++- addons/stock/partner.py | 2 -- addons/stock/product.py | 8 ----- 18 files changed, 120 insertions(+), 47 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index b124bf5a602..9a49a871f42 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -790,9 +790,9 @@ class account_invoice_line(osv.osv): taxep=None if partner_id: lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang'] - taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax tax_obj = self.pool.get('account.tax') if type in ('out_invoice', 'out_refund'): + taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_supplier_tax if not taxep or not taxep.id: tax_id = map(lambda x: x.id, res.taxes_id) else: @@ -801,6 +801,7 @@ class account_invoice_line(osv.osv): if not t.tax_group==taxep.tax_group: tax_id.append(t.id) else: + taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax if not taxep or not taxep.id: tax_id = map(lambda x: x.id, res.supplier_taxes_id) else: diff --git a/addons/account/partner.py b/addons/account/partner.py index b6bcb2324b2..db1179c7a54 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -97,7 +97,6 @@ class res_partner(osv.osv): string="Account Payable", method=True, view_load=True, - group_name="Accounting Properties", domain="[('type', '=', 'payable')]", help="This account will be used, instead of the default one, as the payable account for the current partner", required=True), @@ -108,10 +107,17 @@ class res_partner(osv.osv): string="Account Receivable", method=True, view_load=True, - group_name="Accounting Properties", domain="[('type', '=', 'receivable')]", help="This account will be used, instead of the default one, as the receivable account for the current partner", required=True), + 'property_account_supplier_tax': fields.property( + 'account.tax', + type='many2one', + relation='account.tax', + string="Default Supplier Tax", + method=True, + view_load=True, + help="This tax will be used, instead of the default one for supplier invoices."), 'property_account_tax': fields.property( 'account.tax', type='many2one', @@ -119,8 +125,7 @@ class res_partner(osv.osv): string="Default Tax", method=True, view_load=True, - group_name="Accounting Properties", - help="This tax will be used, instead of the default one."), + help="This tax will be used, instead of the default one for customers."), 'property_payment_term': fields.property( 'account.payment.term', type='many2one', @@ -128,7 +133,6 @@ class res_partner(osv.osv): string ='Payment Term', method=True, view_load=True, - group_name="Accounting Properties", help="This payment term will be used, instead of the default one, for the current partner"), 'ref_companies': fields.one2many('res.company', 'partner_id', 'Companies that refers to partner'), diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index 88ea1d898f8..ccc93735a59 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -2,8 +2,8 @@ + Partners Extension + --> res.partner.form.inherit @@ -18,5 +18,26 @@ + + + res.partner.property.form.inherit + res.partner + form + 2 + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/addons/account/product.py b/addons/account/product.py index c7eca8e1253..ef1d11312bc 100644 --- a/addons/account/product.py +++ b/addons/account/product.py @@ -42,7 +42,6 @@ class product_category(osv.osv): string="Income Account", method=True, view_load=True, - group_name="Accounting Properties", help="This account will be used, instead of the default one, to value incoming stock for the current product category"), 'property_account_expense_categ': fields.property( 'account.account', @@ -51,7 +50,6 @@ class product_category(osv.osv): string="Expense Account", method=True, view_load=True, - group_name="Accounting Properties", help="This account will be used, instead of the default one, to value outgoing stock for the current product category"), } product_category() @@ -75,7 +73,6 @@ class product_template(osv.osv): string="Income Account", method=True, view_load=True, - group_name="Accounting Properties", help="This account will be used, instead of the default one, to value incoming stock for the current product"), 'property_account_expense': fields.property( 'account.account', @@ -84,7 +81,6 @@ class product_template(osv.osv): string="Expense Account", method=True, view_load=True, - group_name="Accounting Properties", help="This account will be used, instead of the default one, to value outgoing stock for the current product"), } product_template() diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml index d4ffd9ea9a5..210788ae7ee 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -15,7 +15,7 @@ - + product.template.product.form.inherit product.template @@ -30,5 +30,55 @@ + + + + + product.category.property.form.inherit + product.category + form + + + + + + + + + + + + + product.template.property.form.inherit + product.template + form + + + + + + + + + + + + + + product.normal.property.form.inherit + product.product + form + + + + + + + + + + + + - \ No newline at end of file + diff --git a/addons/delivery/__terp__.py b/addons/delivery/__terp__.py index 20e7b89f915..85a525b5e31 100644 --- a/addons/delivery/__terp__.py +++ b/addons/delivery/__terp__.py @@ -35,7 +35,7 @@ "depends" : ["sale","purchase", "stock",], "init_xml" : ["delivery_data.xml"], "demo_xml" : ["delivery_demo.xml"], - "update_xml" : ["delivery_view.xml","delivery_wizard.xml"], + "update_xml" : ["delivery_view.xml","delivery_wizard.xml","partner_view.xml"], "active": False, "installable": True, } diff --git a/addons/delivery/partner.py b/addons/delivery/partner.py index a3fb2b81a55..ae68ceb77a4 100644 --- a/addons/delivery/partner.py +++ b/addons/delivery/partner.py @@ -40,7 +40,6 @@ class res_partner(osv.osv): string="Delivery Method", method=True, view_load=True, - group_name="Delivery Properties", help="This carrier will be used, instead of the default one, for delivering goods to the current partner"), } res_partner() diff --git a/addons/mrp/wizard/schedulers.py b/addons/mrp/wizard/schedulers.py index 206e30bbab3..98ff98111ea 100644 --- a/addons/mrp/wizard/schedulers.py +++ b/addons/mrp/wizard/schedulers.py @@ -47,9 +47,8 @@ def _procure_confirm(self, cr, uid, schedule_cycle=1.0, po_cycle=1.0,\ cr = pooler.get_db(use_new_cursor).cursor() wf_service = netsvc.LocalService("workflow") - orderpoint_obj = pooler.get_pool(cr.dbname).get('stock.warehouse.orderpoint') procurement_obj = pooler.get_pool(cr.dbname).get('mrp.procurement') - ids=orderpoint_obj.search(cr,uid,[], order="date_planned") + ids=procurement_obj.search(cr,uid,[], order="date_planned") for id in ids: wf_service.trg_validate(uid, 'mrp.procurement', id, 'button_restart', cr) if use_new_cursor: diff --git a/addons/product/__terp__.py b/addons/product/__terp__.py index 7a99d4327d1..83273f65a6c 100644 --- a/addons/product/__terp__.py +++ b/addons/product/__terp__.py @@ -53,7 +53,8 @@ Print product labels with barcodes. """, "update_xml" : ["product_data.xml","product_report.xml", - "product_view.xml", "pricelist_view.xml","product_security.xml"], + "product_view.xml", "pricelist_view.xml","product_security.xml", + "partner_view.xml"], "active": False, "installable": True } diff --git a/addons/product/partner.py b/addons/product/partner.py index 1435b174742..51a9408878f 100644 --- a/addons/product/partner.py +++ b/addons/product/partner.py @@ -43,7 +43,6 @@ class res_partner(osv.osv): string="Sale Pricelist", method=True, view_load=True, - group_name="Pricelists Properties", help="This pricelist will be used, instead of the default one, \ for sales to the current partner"), } diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 5b3bdbd279a..7c13df2ac63 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -102,7 +102,6 @@ - @@ -127,8 +126,7 @@ - - + @@ -441,7 +439,6 @@ - diff --git a/addons/purchase/__terp__.py b/addons/purchase/__terp__.py index e7eae7b083d..53fb104445e 100644 --- a/addons/purchase/__terp__.py +++ b/addons/purchase/__terp__.py @@ -45,7 +45,8 @@ "purchase_report.xml", "purchase_wizard.xml", "stock_view.xml", - "purchase_security.xml" + "purchase_security.xml", + "partner_view.xml" ], "active": False, "installable": True diff --git a/addons/purchase/partner.py b/addons/purchase/partner.py index 9ae85eacd22..ab831b66bd1 100644 --- a/addons/purchase/partner.py +++ b/addons/purchase/partner.py @@ -41,7 +41,6 @@ class res_partner(osv.osv): string="Purchase Pricelist", method=True, view_load=True, - group_name="Pricelists Properties", help="This pricelist will be used, instead of the default one, for purchases from the current partner"), } res_partner() diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 36db7bb9a02..35c46825008 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -366,6 +366,22 @@ class purchase_order_line(osv.osv): res = {'value': {'price_unit': price, 'name':prod_name, 'taxes_id':prod['supplier_taxes_id'], 'date_planned': dt,'notes':prod['description_purchase'], 'product_uom': uom}} domain = {} + if res['value']['taxes_id']: + taxes = self.pool.get('account.tax').browse(cr, uid, + [x.id for x in product.supplier_taxes_id]) + taxep = None + if partner_id: + taxep = self.pool.get('res.partner').browse(cr, uid, + partner_id).property_account_supplier_tax + if not taxep or not taxep.id: + res['value']['taxes_id'] = [x.id for x in product.taxes_id] + else: + res5 = [taxep.id] + for t in taxes: + if not t.tax_group==taxep.tax_group: + res5.append(t.id) + res['value']['taxes_id'] = res5 + res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id']) res3 = self.pool.get('product.uom').read(cr, uid, [prod_uom_po], ['category_id']) domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]} diff --git a/addons/report_sale/report_sale.py b/addons/report_sale/report_sale.py index 8328b7f037c..9407acddcd8 100644 --- a/addons/report_sale/report_sale.py +++ b/addons/report_sale/report_sale.py @@ -71,15 +71,6 @@ class report_sale_order_product(osv.osv): group by l.product_id, to_char(s.date_order, 'YYYY-MM-01'),s.state ) """) -# Done in the _auto_init -# for k in self._columns: -# f = self._columns[k] -# cr.execute("select id from ir_model_fields where model=%s and name=%s", (self._name,k)) -# if not cr.rowcount: -# cr.execute("select id from ir_model where model='%s'" % self._name) -# model_id = cr.fetchone()[0] -# cr.execute("INSERT INTO ir_model_fields (model_id, model, name, field_description, ttype, relate,relation,group_name,view_load) VALUES (%d,%s,%s,%s,%s,%s,%s,%s,%s)", (model_id, self._name, k, f.string.replace("'", " "), f._type, (f.relate and 'True') or 'False', f._obj or 'NULL', f.group_name or '', (f.view_load and 'True') or 'False')) - report_sale_order_product() class report_sale_order_category(osv.osv): diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py index 248b0414370..0a498ac0ef9 100644 --- a/addons/stock/__terp__.py +++ b/addons/stock/__terp__.py @@ -35,7 +35,16 @@ "category" : "Generic Modules/Inventory Control", "init_xml" : [], "demo_xml" : ["stock_demo.xml"], - "update_xml" : ["stock_workflow.xml", "stock_data.xml", "stock_incoterms.xml","stock_wizard.xml", "stock_view.xml", "stock_report.xml", "stock_sequence.xml", "product_data.xml",], + "update_xml" : [ + "stock_workflow.xml", + "stock_data.xml", + "stock_incoterms.xml","stock_wizard.xml", + "stock_view.xml", + "stock_report.xml", + "stock_sequence.xml", + "product_data.xml", + "product_view.xml" + ], "active": False, "installable": True } diff --git a/addons/stock/partner.py b/addons/stock/partner.py index d3770697f62..41c06fcb557 100644 --- a/addons/stock/partner.py +++ b/addons/stock/partner.py @@ -42,7 +42,6 @@ class res_partner(osv.osv): string="Customer Location", method=True, view_load=True, - group_name="Inventory Properties", help="This stock location will be used, instead of the default one, as the destination location for goods you send to this partner"), 'property_stock_supplier': fields.property( 'stock.location', @@ -51,7 +50,6 @@ class res_partner(osv.osv): string="Supplier Location", method=True, view_load=True, - group_name="Inventory Properties", help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner"), } res_partner() diff --git a/addons/stock/product.py b/addons/stock/product.py index f90a1be63a9..5834a187c22 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -42,7 +42,6 @@ class product_product(osv.osv): string="Procurement Location", method=True, view_load=True, - group_name="Inventory Properties", help="For the current product (template), this stock location will be used, instead of the default one, as the source location for stock moves generated by procurements"), 'property_stock_production': fields.property( 'stock.location', @@ -51,7 +50,6 @@ class product_product(osv.osv): string="Production Location", method=True, view_load=True, - group_name="Inventory Properties", help="For the current product (template), this stock location will be used, instead of the default one, as the source location for stock moves generated by production orders"), 'property_stock_inventory': fields.property( 'stock.location', @@ -60,17 +58,14 @@ class product_product(osv.osv): string="Inventory Location", method=True, view_load=True, - group_name="Inventory Properties", help="For the current product (template), this stock location will be used, instead of the default one, as the source location for stock moves generated when you do an inventory"), 'property_stock_account_input': fields.property('account.account', type='many2one', relation='account.account', string='Stock Input Account', method=True, view_load=True, - group_name='Stock Accounting Properties', help='This account will be used, instead of the default one, to value input stock'), 'property_stock_account_output': fields.property('account.account', type='many2one', relation='account.account', string='Stock Output Account', method=True, view_load=True, - group_name='Stock Accounting Properties', help='This account will be used, instead of the default one, to value output stock'), } @@ -83,17 +78,14 @@ class product_category(osv.osv): 'property_stock_journal': fields.property('account.journal', relation='account.journal', type='many2one', string='Stock journal', method=True, view_load=True, - group_name="Accounting Properties", help="This journal will be used for the accounting move generated by stock move"), 'property_stock_account_input_categ': fields.property('account.account', type='many2one', relation='account.account', string='Stock Input Account', method=True, view_load=True, - group_name='Stock Accounting Properties', help='This account will be used to value the input stock'), 'property_stock_account_output_categ': fields.property('account.account', type='many2one', relation='account.account', string='Stock Output Account', method=True, view_load=True, - group_name='Stock Accounting Properties', help='This account will be used to value the output stock'), }