Modifications on properties in views

bzr revid: fp@tinyerp.com-20080819192629-1nu8lwr8x1xq8o2t
This commit is contained in:
Fabien Pinckaers 2008-08-19 21:26:29 +02:00
parent fc62fe34d2
commit 7b96685167
18 changed files with 120 additions and 47 deletions

View File

@ -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:

View File

@ -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'),

View File

@ -2,8 +2,8 @@
<terp>
<data>
<!--
Partners Extension
-->
Partners Extension
-->
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form.inherit</field>
@ -18,5 +18,26 @@
</field>
</field>
</record>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="priority">2</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<newline/>
<separator string="Customer Accounting Properties" colspan="2"/>
<separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_receivable"/>
<field name="property_account_payable"/>
<field name="property_account_tax"/>
<field name="property_account_supplier_tax"/>
<field name="property_payment_term"/>
</page>
</field>
</record>
</data>
</terp>
</terp>

View File

@ -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()

View File

@ -15,7 +15,7 @@
</field>
</field>
</record>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.product.form.inherit</field>
<field name="model">product.template</field>
@ -30,5 +30,55 @@
</field>
</field>
</record>
<record id="view_category_property_form" model="ir.ui.view">
<field name="name">product.category.property.form.inherit</field>
<field name="model">product.category</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<group string="Properties" position="inside">
<field name="property_account_income_categ"/>
<field name="property_account_expense_categ"/>
</group>
</field>
</record>
<record id="view_template_property_form" model="ir.ui.view">
<field name="name">product.template.property.form.inherit</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchases Properties" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
</page>
</field>
</record>
<record id="view_normal_property_form" model="ir.ui.view">
<field name="name">product.normal.property.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchases Properties" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
</page>
</field>
</record>
</data>
</terp>
</terp>

View File

@ -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,
}

View File

@ -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()

View File

@ -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:

View File

@ -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
}

View File

@ -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"),
}

View File

@ -102,7 +102,6 @@
</field>
</page>
<page groups="base.group_extended" string="Properties">
<properties/>
</page>
</notebook>
</form>
@ -127,8 +126,7 @@
<field name="name" select="1"/>
<field name="parent_id"/>
<field name="sequence"/>
<group colspan="4" groups="base.group_extended">
<properties/>
<group string="Properties" colspan="4" groups="base.group_extended">
</group>
</form>
</field>
@ -441,7 +439,6 @@
<field colspan="4" name="description_purchase" nolabel="1"/>
</page>
<page string="Properties">
<properties/>
</page>
</notebook>
</form>

View File

@ -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

View File

@ -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()

View File

@ -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])]}

View File

@ -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):

View File

@ -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
}

View File

@ -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()

View File

@ -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'),
}