[MERGE] with lp:~openerp-dev/openobject-addons/trunk-product-variant-imp-amb and change necessary code.

bzr revid: dka@tinyerp.com-20131121122311-629hbtetmqfrtfyg
This commit is contained in:
Darshan Kalola (OpenERP) 2013-11-21 17:53:11 +05:30
commit f19a433dbb
20 changed files with 1751 additions and 887 deletions

View File

@ -31,12 +31,16 @@
<field name="arch" type="xml">
<notebook position="inside">
<page string="Accounting">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchase Properties" colspan="2"/>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="taxes_id"/>
<field name="supplier_taxes_id"/>
<group name="properties">
<group>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="taxes_id" colspan="2" widget="many2many_tags"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
</group>
</group>
</page>
</notebook>
</field>

View File

@ -19,7 +19,7 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="account.product_template_form_view"/>
<field name="arch" type="xml">
<field name="property_account_expense" position="after">
<xpath expr="//field[@name='property_account_expense']" position="after">
<field name="property_account_creditor_price_difference" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
<newline/>
</field>

View File

@ -14,6 +14,8 @@
groups_id:
- mrp.group_mrp_manager
- account.group_account_user
- purchase.group_purchase_user
- stock.group_stock_manager
-
Create a user as 'MRP User'
-

View File

@ -2,7 +2,7 @@
MRP user can doing all process related to Production Order, so let's check data with giving the access rights of user.
-
!context
uid: 'res_users_mrp_user'
uid: 'res_users_mrp_manager'
-
I compute the production order.
-

View File

@ -79,7 +79,8 @@ Main Features
'demo': [
'point_of_sale_demo.xml',
'account_statement_demo.xml',
'test/00_register_open.yml'
'test/00_register_open.yml',
'product_image_demo.xml'
],
'test': [
'test/01_order_to_payment.yml',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -81,12 +81,12 @@
discount: 0.0
qty: 3.0
-
I check that the total of the order is equal to 450*2 + 300*3*1.05 and the tax of the order is equal to 900 -(450 * 2 / 1.1) + 300*0.05*3
I check that the total of the order is equal to 450*2 + 300*3*1.10 and the tax of the order is equal to 900 -(450 * 2) + 300*1.10*3
-
!python {model: pos.order}: |
order = self.browse(cr, uid, ref('pos_order_pos0'))
assert(abs(order.amount_total - (450*2 + 300*3*1.05)) < 0.01), "The order has a wrong amount, tax included"
assert(abs(order.amount_tax - (900-(450*2/1.1) + 300*0.05*3)) < 0.01), "The order has a wrong tax amount"
assert(abs(order.amount_total - (450*2 + 300*3*1.10)) < 0.01), "The order has a wrong amount, tax included"
assert(abs(order.amount_tax - (900-(450*2) + 300*0.10*3)) < 0.01), "The order has a wrong tax amount"
-
I want to add a global discount of 5 percent using the wizard
-
@ -99,11 +99,11 @@
self.apply_discount(cr, uid, [ref("pos_discount_0")], {"active_model": "pos.order",
"active_ids": [ref("pos_order_pos0")], "active_id": ref("pos_order_pos0"), })
-
I check that the total of the order is now equal to (450*2 + 300*3*1.05)*0.95
I check that the total of the order is now equal to (450*2 + 300*3*1.10)*0.95
-
!python {model: pos.order}: |
order = self.browse(cr, uid, ref('pos_order_pos0'))
assert(abs(order.amount_total - (450*2 + 300*3*1.05)*0.95) < 0.01), "The order has a wrong total including tax and discounts"
assert(abs(order.amount_total - (450*2 + 300*3*1.10)*0.95) < 0.01), "The order has a wrong total including tax and discounts"
-
I click on the "Make Payment" wizard to pay the PoS order with a partial amount of 100.0 EUR
-
@ -124,13 +124,13 @@
-
!python {model: pos.make.payment}: |
defs = self.default_get(cr, uid, ['amount'], {'active_id': ref('pos_order_pos0')})
assert abs(defs['amount'] - ((450*2 + 300*3*1.05)*0.95-100.0)) < 0.01, "The remaining balance is incorrect"
assert abs(defs['amount'] - ((450*2 + 300*3*1.10)*0.95-100.0)) < 0.01, "The remaining balance is incorrect"
-
I pay the remaining balance.
-
!record {model: pos.make.payment, id: pos_make_payment_1, context: '{"active_id": ref("pos_order_pos0"), "active_ids": [ref("pos_order_pos0")]}' }:
amount: !eval >
(450*2 + 300*3*1.05)*0.95-100.0
(450*2 + 300*3*1.10)*0.95-100.0
-
I click on the validate button to register the payment.
-

View File

@ -20,7 +20,7 @@
-
!record {model: pos.make.payment, id: pos_make_payment_2, context: '{"active_id": ref("pos_order_pos1"), "active_ids": [ref("pos_order_pos1")]}' }:
amount: !eval >
(450*2 + 300*3*1.05)*0.95
(450*2 + 300*3*1.10)*0.95
-
I click on the validate button to register the payment.
-
@ -43,4 +43,4 @@
I test that the total of the attached invoice is correct
-
!assert {model: pos.order, id: pos_order_pos1, string: Invoice not correct}:
- amount_total == (450*2 + 300*3*1.05)*0.95
- amount_total == (450*2 + 300*3*1.10)*0.95

View File

@ -291,15 +291,49 @@
<field name="res_model">stock.warehouse.orderpoint</field>
</record>
<record id="product_template_search_view_procurment" model="ir.ui.view">
<field name="name">product.template.search.procurment</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<filter name="consumable" position="before">
<filter string="Products" icon="terp-accessories-archiver" domain="[('type','=','product')]" help="Stockable products"/>
</filter>
</field>
</record>
<record model="ir.ui.view" id="product_template_form_view_procurement">
<field name="name">product.template.procurement</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="after">
<xpath expr="//field[@name='cost_method']" position="before">
<field name="procure_method"/>
<field name="supply_method"/>
</xpath>
<xpath expr="//group[@name='general']" position="after" >
<group name="procurement_help" class="oe_grey" col="1" groups="base.group_user">
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','service'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this service, nothing special will be triggered
to deliver the customer, as you set the procurement method as
'Make to Stock'.
</p>
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','product'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this product, OpenERP will <b>use the available
inventory</b> for the delivery order.
<br/><br/>
If there are not enough quantities available, the delivery order
will wait for new products. To fulfill the inventory, you should
create others rules like orderpoints.
</p>
<p attrs="{'invisible': ['|','|',('type','&lt;&gt;','consu'),('procure_method','&lt;&gt;','make_to_stock')]}">
When you sell this product, a delivery order will be created.
OpenERP will consider that the <b>required quantities are always
available</b> as it's a consumable (as a result of this, the quantity
on hand may become negative).
</p>
</group>
</xpath>
</field>
</record>

View File

@ -62,6 +62,7 @@ Print product labels with barcode.
'product_pricelist_demo.yml',
'test/product_uom.yml',
'test/product_pricelist.yml',
'test/compute_price_margin.yml',
],
'installable': True,
'auto_install': False,

View File

@ -367,6 +367,11 @@ class product_template(osv.osv):
result = dict.fromkeys(ids, False)
for obj in self.browse(cr, uid, ids, context=context):
result[obj.id] = tools.image_get_resized_images(obj.image, avoid_resize_medium=True)
product = self.pool.get('product.product')
product_ids = product.search(cr, uid, [('product_tmpl_id','in',ids)], context=context)
for product_obj in product.browse(cr, uid, product_ids, context=context):
if not product_obj.image:
product.write(cr, uid, product_obj.id, {'image': product_obj.product_tmpl_id.image}, context=context)
return result
def _set_image(self, cr, uid, id, name, value, args, context=None):
@ -389,7 +394,7 @@ class product_template(osv.osv):
'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"),
'public_categ_id': fields.many2one('product.public.category','Public Category', help="Those categories are used to group similar products for public sales (eg.: point of sale, e-commerce)."),
'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price to compute the customer price. Sometimes called the catalog price."),
'standard_price': fields.float('Cost', digits_compute=dp.get_precision('Product Price'), help="Cost price of the product used for standard stock valuation in accounting and used as a base price on purchase orders.", groups="base.group_user"),
'standard_price': fields.float('Cost Price', digits_compute=dp.get_precision('Product Price'), help="Cost price of the product template used for standard stock valuation in accounting and used as a base price on purchase orders.", groups="base.group_user"),
'volume': fields.float('Volume', help="The volume in m3."),
'weight': fields.float('Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The gross weight in Kg."),
'weight_net': fields.float('Net Weight', digits_compute=dp.get_precision('Stock Weight'), help="The net weight in Kg."),
@ -418,7 +423,7 @@ class product_template(osv.osv):
'image_medium': fields.function(_get_image, fnct_inv=_set_image,
string="Medium-sized image", type="binary", multi="_get_image",
store={
'product.product': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
'product.template': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Medium-sized image of the product. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved, "\
@ -426,7 +431,7 @@ class product_template(osv.osv):
'image_small': fields.function(_get_image, fnct_inv=_set_image,
string="Small-sized image", type="binary", multi="_get_image",
store={
'product.product': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
'product.template': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Small-sized image of the product. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
@ -466,6 +471,17 @@ class product_template(osv.osv):
raise osv.except_osv(_('Unit of Measure categories Mismatch!'), _("New Unit of Measure '%s' must belong to same Unit of Measure category '%s' as of old Unit of Measure '%s'. If you need to change the unit of measure, you may deactivate this product from the 'Procurements' tab and create a new one.") % (new_uom.name, old_uom.category_id.name, old_uom.name,))
return super(product_template, self).write(cr, uid, ids, vals, context=context)
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
template = self.read(cr, uid, id, ['name', 'product_variant_ids'], context=context)
default = default.copy()
default.update(name=_("%s (copy)") % (template['name']))
id = super(product_template, self).copy(cr, uid, id, default=default, context=context)
if template['product_variant_ids']:
self.write(cr, uid, id, default, context)
return id
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', context=c),
'list_price': 1,
@ -561,7 +577,7 @@ class product_product(osv.osv):
uom.id, product.list_price, context['uom'])
else:
res[product.id] = product.list_price
res[product.id] = (res[product.id] or 0.0) * (product.price_margin or 1.0) + product.price_extra
res[product.id] = (res[product.id] + ((res[product.id] * (product.price_margin)) / 100)) + product.price_extra
return res
def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context=None):
@ -623,6 +639,15 @@ class product_product(osv.osv):
return result
def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)
for obj in self.browse(cr, uid, ids, context=context):
result[obj.id] = tools.image_get_resized_images(obj.image, avoid_resize_medium=True)
return result
def _set_image(self, cr, uid, id, name, value, args, context=None):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
def _get_name_template_ids(self, cr, uid, ids, context=None):
result = set()
template_ids = self.pool.get('product.product').search(cr, uid, [('product_tmpl_id', 'in', ids)])
@ -633,7 +658,7 @@ class product_product(osv.osv):
_defaults = {
'active': lambda *a: 1,
'price_extra': lambda *a: 0.0,
'price_margin': lambda *a: 1.0,
'price_margin': lambda *a: 0.0,
'color': 0,
}
@ -667,11 +692,40 @@ class product_product(osv.osv):
}, select=True),
'color': fields.integer('Color Index'),
# image: all image fields are base64 encoded and PIL-supported
'image': fields.binary("Image",
help="This field holds the image used as image for the product, limited to 1024x1024px."),
'image_medium': fields.function(_get_image, fnct_inv=_set_image,
string="Medium-sized image", type="binary", multi="_get_image",
store={
'product.product': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Medium-sized image of the product. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved, "\
"only when the image exceeds one of those sizes. Use this field in form views or some kanban views."),
'image_small': fields.function(_get_image, fnct_inv=_set_image,
string="Small-sized image", type="binary", multi="_get_image",
store={
'product.product': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Small-sized image of the product. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required."),
'seller_info_id': fields.function(_calc_seller, type='many2one', relation="product.supplierinfo", string="Supplier Info", multi="seller_info"),
'seller_delay': fields.function(_calc_seller, type='integer', string='Supplier Lead Time', multi="seller_info", help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_qty': fields.function(_calc_seller, type='float', string='Supplier Quantity', multi="seller_info", help="This is minimum quantity to purchase from Main Supplier."),
'seller_id': fields.function(_calc_seller, type='many2one', relation="res.partner", string='Main Supplier', help="Main Supplier who has highest priority in Supplier List.", multi="seller_info"),
'description': fields.text('Description',translate=True,
help="A precise description of the Product, used only for internal information purposes."),
}
def create(self, cr, uid, data, context=None):
if 'product_tmpl_id' in data:
template = self.pool.get('product.template').browse(cr, uid, data['product_tmpl_id'], context=context)
if template.image:
data['image'] = template.image
return super(product_product, self).create(cr, uid, data, context=context)
def unlink(self, cr, uid, ids, context=None):
unlink_ids = []
unlink_product_tmpl_ids = []
@ -685,7 +739,8 @@ class product_product(osv.osv):
res = super(product_product, self).unlink(cr, uid, unlink_ids, context=context)
# delete templates after calling super, as deleting template could lead to deleting
# products due to ondelete='cascade'
self.pool.get('product.template').unlink(cr, uid, unlink_product_tmpl_ids, context=context)
#Deprecated code : As per new scenario no need to delete the 'product-template' while delete the product.
#self.pool.get('product.template').unlink(cr, uid, unlink_product_tmpl_ids, context=context)
return res
def onchange_uom(self, cursor, user, ids, uom_id, uom_po_id):
@ -761,7 +816,7 @@ class product_product(osv.osv):
# OR operator (and given the fact that the 'name' lookup results come from the ir.translation table
# Performing a quick memory merge of ids in Python will give much better performance
ids = set()
ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context))
ids.update(self.search(cr, user, args + ['|',('default_code',operator,name),('variants',operator,name)], limit=limit, context=context))
if not limit or len(ids) < limit:
# we may underrun the limit because of dupes in the results, that's fine
ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit and (limit-len(ids)) or False) , context=context))
@ -793,7 +848,7 @@ class product_product(osv.osv):
for product in self.browse(cr, uid, ids, context=context):
res[product.id] = product[ptype] or 0.0
if ptype == 'list_price':
res[product.id] = (res[product.id] * (product.price_margin or 1.0)) + \
res[product.id] = (res[product.id] + ((res[product.id] * (product.price_margin)) / 100)) + \
product.price_extra
if 'uom' in context:
uom = product.uom_id or product.uos_id
@ -819,9 +874,12 @@ class product_product(osv.osv):
# will do the other languages).
context_wo_lang = context.copy()
context_wo_lang.pop('lang', None)
product = self.read(cr, uid, id, ['name'], context=context_wo_lang)
product = self.read(cr, uid, id, ['name', 'list_price', 'standard_price', 'categ_id', 'variants', 'product_tmpl_id'], context=context_wo_lang)
default = default.copy()
default.update(name=_("%s (copy)") % (product['name']))
if product['variants']:
default.update(variants=_("%s (copy)") % (product['variants']), product_tmpl_id=product['product_tmpl_id'][0])
else:
default.update(name=_("%s (copy)") % (product['name']), list_price=product['list_price'], standard_price=product['standard_price'], categ_id=product['categ_id'][0], product_tmpl_id=None)
if context.get('variant',False):
fields = ['product_tmpl_id', 'active', 'variants', 'default_code',
@ -838,6 +896,18 @@ class product_product(osv.osv):
return super(product_product, self).copy(cr, uid, id, default=default,
context=context)
def copy_translations(self, cr, uid, old_id, new_id, context=None):
""" When we do not copy the template along the variant,
copy_translations sometimes receives 2 identical IDs.
That's because the ORM follows the o2m to copy the translations,
so in that case, it follows 'variant_ids' and for each variant,
it copy the translations. One of the variant is the 'new_id'.
Just skip the identical IDs.
"""
if old_id == new_id:
return
super(product_product, self).copy_translations(cr, uid, old_id, new_id, context=context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}

View File

@ -189,7 +189,7 @@ parameter) will see those record just disappear.
<!--
Product
-->
<record id="product_product_consultant" model="product.product">
<record id="product_template_consultant" model="product.template">
<field name="list_price">75.0</field>
<field name="standard_price">30.0</field>
<field name="uom_id" ref="product.product_uom_hour"/>
@ -198,6 +198,9 @@ parameter) will see those record just disappear.
<field name="categ_id" ref="product.product_category_all"/>
<field name="type">service</field>
</record>
<record id="product_product_consultant" model="product.product">
<field name="product_tmpl_id" ref="product_template_consultant"/>
</record>
<!-- Product Public Categories -->
<record id="categ_others" model="product.public.category">

View File

@ -244,7 +244,7 @@
<record id="product_template_3" model="product.template">
<field name="name">PC Assemble SC234</field>
<field name="name">PC Assemble</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="Computer_all_in_one"/>
<field name="list_price">450.0</field>
@ -252,17 +252,18 @@
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description_sale">17" LCD Monitor
Processor AMD 8-Core
512MB RAM
HDD SH-1</field>
</record>
<record id="product_product_3" model="product.product">
<field name="product_tmpl_id" ref="product_template_3"/>
<field name="default_code">PCSC234</field>
<field name="variants">SC234</field>
<field name="price_extra">0.0</field>
<field name="description">17" LCD Monitor
Processor AMD 8-Core
512MB RAM
HDD SH-1</field>
</record>
<record id="product_template_4" model="product.template">
<field name="name">iPad Retina Display</field>
<field name="categ_id" ref="ipad"/>
@ -294,6 +295,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<field name="description">Custom computer assembled on order based on customer's requirement.</field>
<field name="description_sale">Bose's smallest portable Bluetooth speaker</field>
</record>
<record id="product_product_5" model="product.product">
<field name="product_tmpl_id" ref="product_template_5"/>
<field name="default_code">B3423</field>
@ -310,6 +312,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_6" model="product.product">
<field name="product_tmpl_id" ref="product_template_6"/>
<field name="default_code">A1232</field>
@ -360,7 +363,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
</record>
<record id="product_template_10" model="product.template">
<field name="name">Mouse, Optical</field>
<field name="name">Mouse</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Keyboard_Mouse"/>
<field name="standard_price">12.50</field>
@ -372,6 +375,14 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<record id="product_product_10" model="product.product">
<field name="product_tmpl_id" ref="product_template_10"/>
<field name="default_code">M-Opt</field>
<field name="variants">Optical</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_product_12" model="product.product">
<field name="product_tmpl_id" ref="product_template_10"/>
<field name="default_code">M-Wir</field>
<field name="variants">Wireless</field>
<field name="price_extra">1.50</field>
</record>
<record id="product_template_11" model="product.template">
@ -404,23 +415,9 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<field name="product_tmpl_id" ref="product_template_11"/>
</record>
<record id="product_template_12" model="product.template">
<field name="name">Mouse, Wireless</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Keyboard_Mouse"/>
<field name="standard_price">18</field>
<field name="list_price">12.50</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_12" model="product.product">
<field name="product_tmpl_id" ref="product_template_12"/>
<field name="default_code">M-Wir</field>
</record>
<record id="product_template_13" model="product.template">
<field name="name">RAM SR5</field>
<field name="name">RAM</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Memory"/>
<field name="standard_price">78.0</field>
@ -432,36 +429,22 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<record id="product_product_13" model="product.product">
<field name="product_tmpl_id" ref="product_template_13"/>
<field name="default_code">RAM-SR5</field>
<field name="variants">1GB-SR5</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_template_14" model="product.template">
<field name="name">RAM SR2</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Memory"/>
<field name="standard_price">87.0</field>
<field name="list_price">95.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_14" model="product.product">
<field name="product_tmpl_id" ref="product_template_14"/>
<field name="product_tmpl_id" ref="product_template_13"/>
<field name="default_code">RAM-SR2</field>
<field name="variants">2GB-SR2</field>
<field name="price_extra">10.0</field>
</record>
<record id="product_template_15" model="product.template">
<field name="name">RAM SR3</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="Memory"/>
<field name="standard_price">80.0</field>
<field name="list_price">85.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_15" model="product.product">
<field name="product_tmpl_id" ref="product_template_15"/>
<field name="product_tmpl_id" ref="product_template_13"/>
<field name="default_code">RAM-SR3</field>
<field name="variants">1GB-SR3</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_template_16" model="product.template">
@ -480,7 +463,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
</record>
<record id="product_template_17" model="product.template">
<field name="name">HDD SH-1</field>
<field name="name">Hard Disk Drive</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="HDD"/>
<field name="standard_price">860.0</field>
@ -492,41 +475,27 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<record id="product_product_17" model="product.product">
<field name="product_tmpl_id" ref="product_template_17"/>
<field name="default_code">HDD-SH1</field>
<field name="variants">180GB-SH1</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_template_18" model="product.template">
<field name="name">HDD SH-2</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="HDD"/>
<field name="standard_price">1020.0</field>
<field name="list_price">1150.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_18" model="product.product">
<field name="product_tmpl_id" ref="product_template_18"/>
<field name="product_tmpl_id" ref="product_template_17"/>
<field name="default_code">HDD-SH2</field>
<field name="variants">180GB-SH2</field>
<field name="price_extra">175.0</field>
</record>
<record id="product_template_19" model="product.template">
<field name="name">HDD on Demand</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="HDD"/>
<field name="standard_price">1100.0</field>
<field name="list_price">1250.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description">On demand hard-disk having capacity based on requirement.</field>
</record>
<record id="product_product_19" model="product.product">
<field name="product_tmpl_id" ref="product_template_19"/>
<field name="product_tmpl_id" ref="product_template_17"/>
<field name="default_code">HDD-DEM</field>
<field name="variants">On Demand</field>
<field name="price_extra">275.0</field>
<field name="description">On demand hard-disk having capacity based on requirement.</field>
</record>
<record id="product_template_20" model="product.template">
<field name="name">Motherboard I9P57</field>
<field name="name">Motherboard</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="motherboard"/>
<field name="standard_price">1700.0</field>
@ -538,21 +507,15 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<record id="product_product_20" model="product.product">
<field name="product_tmpl_id" ref="product_template_20"/>
<field name="default_code">MBi9</field>
<field name="variants">I9P57</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_template_21" model="product.template">
<field name="name">Motherboard A20Z7</field>
<field name="categ_id" ref="product_category_8"/>
<field name="public_categ_id" ref="motherboard"/>
<field name="standard_price">1790.0</field>
<field name="list_price">2000.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_21" model="product.product">
<field name="product_tmpl_id" ref="product_template_21"/>
<field name="product_tmpl_id" ref="product_template_20"/>
<field name="default_code">MBa20</field>
<field name="variants">A20Z7</field>
<field name="price_extra">50.0</field>
</record>
<record id="product_template_22" model="product.template">
@ -601,7 +564,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
</record>
<record id="product_template_25" model="product.template">
<field name="name">Laptop E5023</field>
<field name="name">Laptop</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="laptops"/>
<field name="standard_price">2870.0</field>
@ -609,49 +572,35 @@ FaceTime HD Camera, 1.2 MP Photos</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_25" model="product.product">
<field name="product_tmpl_id" ref="product_template_25"/>
<field name="default_code">LAP-E5</field>
<field name="variants">E5023</field>
<field name="price_extra">0.0</field>
<field name="description">17" Monitor
4GB RAM
Standard-1294P Processor
QWERTY keyboard</field>
</record>
<record id="product_product_25" model="product.product">
<field name="product_tmpl_id" ref="product_template_25"/>
<field name="default_code">LAP-E5</field>
</record>
<record id="product_template_26" model="product.template">
<field name="name">Laptop S3450</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="laptops"/>
<field name="standard_price">3000.0</field>
<field name="list_price">3245.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<record id="product_product_26" model="product.product">
<field name="product_tmpl_id" ref="product_template_25"/>
<field name="default_code">LAP-S3</field>
<field name="variants">S3450</field>
<field name="price_extra">295.0</field>
<field name="description">17" Monitor
6GB RAM
Hi-Speed 234Q Processor
QWERTY keyboard</field>
</record>
<record id="product_product_26" model="product.product">
<field name="product_tmpl_id" ref="product_template_26"/>
<field name="default_code">LAP-S3</field>
</record>
<record id="product_template_27" model="product.template">
<field name="name">Laptop Customized</field>
<field name="categ_id" ref="product_category_4"/>
<field name="public_categ_id" ref="laptops"/>
<field name="standard_price">3300.0</field>
<field name="list_price">3645.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description">Custom Laptop based on customer's requirement.</field>
</record>
<record id="product_product_27" model="product.product">
<field name="product_tmpl_id" ref="product_template_27"/>
<field name="product_tmpl_id" ref="product_template_25"/>
<field name="default_code">LAP-CUS</field>
<field name="variants">Customized</field>
<field name="price_extra">695.0</field>
<field name="description">Custom Laptop based on customer's requirement.</field>
</record>
<record id="product_template_28" model="product.template">
@ -671,7 +620,7 @@ QWERTY keyboard</field>
<record id="product_template_29" model="product.template">
<field name="name">Pen drive, SP-2</field>
<field name="name">Pen Drive, SP-2</field>
<field name="categ_id" ref="product_category_7"/>
<field name="public_categ_id" ref="Pen_Drive"/>
<field name="standard_price">90.0</field>
@ -683,22 +632,16 @@ QWERTY keyboard</field>
<record id="product_product_29" model="product.product">
<field name="product_tmpl_id" ref="product_template_29"/>
<field name="default_code">PD-SP2</field>
<field name="variants">4GB-SP2</field>
<field name="price_extra">0.0</field>
</record>
<record id="product_template_30" model="product.template">
<field name="name">Pen drive, SP-4</field>
<field name="categ_id" ref="product_category_7"/>
<field name="public_categ_id" ref="Pen_Drive"/>
<field name="standard_price">126.0</field>
<field name="list_price">145.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
</record>
<record id="product_product_30" model="product.product">
<field name="product_tmpl_id" ref="product_template_30"/>
<field name="product_tmpl_id" ref="product_template_29"/>
<field name="default_code">PD-SP4</field>
<field name="variants">8GB-SP4</field>
<field name="price_extra">45</field>
</record>
<record id="product_template_31" model="product.template">
@ -718,7 +661,7 @@ QWERTY keyboard</field>
</record>
<record id="product_template_32" model="product.template">
<field name="name">Headset standard</field>
<field name="name">Headset</field>
<field name="categ_id" ref="product_category_7"/>
<field name="public_categ_id" ref="Headset"/>
<field name="standard_price">57.0</field>
@ -726,27 +669,22 @@ QWERTY keyboard</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description">Hands free headset for laptop PC with in-line microphone and headphone plug.</field>
</record>
<record id="product_product_32" model="product.product">
<field name="product_tmpl_id" ref="product_template_32"/>
<field name="default_code">HEAD</field>
<field name="variants">Standard</field>
<field name="price_extra">0.0</field>
<field name="description">Hands free headset for laptop PC with in-line microphone and headphone plug.</field>
</record>
<record id="product_template_33" model="product.template">
<field name="name">Headset USB</field>
<field name="categ_id" ref="product_category_7"/>
<field name="public_categ_id" ref="Headset"/>
<field name="standard_price">60.0</field>
<field name="list_price">65.0</field>
<field name="type">consu</field>
<field name="uom_id" ref="product_uom_unit"/>
<field name="uom_po_id" ref="product_uom_unit"/>
<field name="description">Headset for laptop PC with USB connector.</field>
</record>
<record id="product_product_33" model="product.product">
<field name="product_tmpl_id" ref="product_template_33"/>
<field name="product_tmpl_id" ref="product_template_32"/>
<field name="default_code">HEAD-USB</field>
<field name="variants">USB</field>
<field name="price_extra">30.0</field>
<field name="description">Headset for laptop PC with USB connector.</field>
</record>
@ -1022,6 +960,7 @@ QWERTY keyboard</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_5" model="product.supplierinfo">
<field name="product_id" ref="product_template_8"/>
<field name="name" ref="base.res_partner_16"/>
@ -1057,22 +996,8 @@ QWERTY keyboard</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_10" model="product.supplierinfo">
<field name="product_id" ref="product_template_14"/>
<field name="name" ref="base.res_partner_4"/>
<field name="delay">5</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_11" model="product.supplierinfo">
<field name="product_id" ref="product_template_15"/>
<field name="name" ref="base.res_partner_4"/>
<field name="delay">5</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_12" model="product.supplierinfo">
<field name="product_id" ref="product_template_15"/>
<field name="product_id" ref="product_template_13"/>
<field name="name" ref="base.res_partner_1"/>
<field name="delay">1</field>
<field name="min_qty">1</field>
@ -1106,20 +1031,6 @@ QWERTY keyboard</field>
<field name="min_qty">5</field>
</record>
<record id="product_supplierinfo_17" model="product.supplierinfo">
<field name="product_id" ref="product_template_21"/>
<field name="name" ref="base.res_partner_4"/>
<field name="delay">3</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_18" model="product.supplierinfo">
<field name="product_id" ref="product_template_21"/>
<field name="name" ref="base.res_partner_16"/>
<field name="delay">2</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_19" model="product.supplierinfo">
<field name="product_id" ref="product_template_22"/>
<field name="name" ref="base.res_partner_19"/>
@ -1148,13 +1059,6 @@ QWERTY keyboard</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_23" model="product.supplierinfo">
<field name="product_id" ref="product_template_26"/>
<field name="name" ref="base.res_partner_1"/>
<field name="delay">8</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_24" model="product.supplierinfo">
<field name="product_id" ref="product_template_28"/>
<field name="name" ref="base.res_partner_19"/>
@ -1176,13 +1080,6 @@ QWERTY keyboard</field>
<field name="min_qty">12</field>
</record>
<record id="product_supplierinfo_27" model="product.supplierinfo">
<field name="product_id" ref="product_template_30"/>
<field name="name" ref="base.res_partner_3"/>
<field name="delay">2</field>
<field name="min_qty">12</field>
</record>
<record id="product_supplierinfo_28" model="product.supplierinfo">
<field name="product_id" ref="product_template_31"/>
<field name="name" ref="base.res_partner_3"/>
@ -1260,55 +1157,27 @@ QWERTY keyboard</field>
<field name="min_qty">1</field>
</record-->
<record id="product_supplierinfo_39" model="product.supplierinfo">
<field name="product_id" ref="product_template_18"/>
<field name="name" ref="base.res_partner_19"/>
<field name="delay">4</field>
<field name="min_qty">1</field>
</record>
<record id="product_supplierinfo_40" model="product.supplierinfo">
<field name="product_id" ref="product_template_19"/>
<field name="product_id" ref="product_template_17"/>
<field name="name" ref="base.res_partner_1"/>
<field name="delay">4</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_41" model="product.supplierinfo">
<field name="product_id" ref="product_template_19"/>
<field name="product_id" ref="product_template_17"/>
<field name="name" ref="base.res_partner_8"/>
<field name="delay">5</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_42" model="product.supplierinfo">
<field name="product_id" ref="product_template_33"/>
<field name="name" ref="base.res_partner_3"/>
<field name="delay">2</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_43" model="product.supplierinfo">
<field name="product_id" ref="product_template_9"/>
<field name="name" ref="base.res_partner_8"/>
<field name="delay">4</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_44" model="product.supplierinfo">
<field name="product_id" ref="product_template_27"/>
<field name="product_id" ref="product_template_25"/>
<field name="name" ref="base.res_partner_1"/>
<field name="delay">10</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_45" model="product.supplierinfo">
<field name="product_id" ref="product_template_12"/>
<field name="name" ref="base.res_partner_16"/>
<field name="delay">3</field>
<field name="min_qty">0</field>
</record>
<record id="product_supplierinfo_46" model="product.supplierinfo">
<field name="product_id" ref="product_template_37"/>
<field name="name" ref="base.res_partner_22"/>

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
<field name="model">product.product</field>
<field name="arch" type="xml">
<search string="Product">
<field name="name" string="Product" filter_domain="['|',('name','ilike',self),('default_code','ilike',self)]"/>
<field name="name" string="Product" filter_domain="['|','|',('name','ilike',self),('default_code','ilike',self),('variants','ilike',self)]"/>
<filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
<filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
<separator/>
@ -23,6 +23,7 @@
<filter string='Default Unit of Measure' icon="terp-mrp" domain="[]" context="{'group_by' : 'uom_id'}"/>
<filter string='Type' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'type'}"/>
<filter string='Company' icon="terp-go-home" domain="[]" context="{'group_by' : 'company_id'}" groups="base.group_multi_company"/>
<filter string='Template' name="template_id" domain="[]" context="{'group_by' : 'product_tmpl_id'}"/>
</group>
</search>
</field>
@ -36,6 +37,7 @@
<tree colors="red:virtual_available&lt;0;blue:virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete');black:virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')" string="Products">
<field name="default_code"/>
<field name="name"/>
<field name="variants"/>
<field name="categ_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="uom_id" string="Unit of Measure" groups="product.group_uom"/>
@ -46,6 +48,7 @@
<field name="standard_price" invisible="1"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company" invisible="1"/>
<field name="product_tmpl_id" invisible="1"/>
</tree>
</field>
</record>
@ -63,7 +66,9 @@
<label for="name" string="Product Name"/>
</div>
<h1>
<field name="name"/>
<field name="name" class="oe_inline"/>
<span attrs="{'invisible':[('variants','=',False)]}"> - </span>
<field name="variants" class="oe_inline" readonly="1"/>
</h1>
<label for="categ_id" class="oe_edit_only"/>
<h2><field name="categ_id"/></h2>
@ -82,7 +87,8 @@
<group>
<field name="type"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="list_price"/>
<field name="list_price" string="Base Sale Price"/>
<field name="lst_price" string="Public Sale Price"/>
</group>
<group>
<field name="default_code"/>
@ -189,7 +195,7 @@
<div class="oe_kanban_details">
<h4>
<a type="open">
<t t-if="record.code.raw_value">[<field name="code"/>]</t> <field name="name"/>
<t t-if="record.code.raw_value">[<field name="code"/>]</t> <field name="name"/> <t t-if="record.variants.raw_value">(<field name="variants"/>)</t>
</a>
</h4>
<div name="tags"/>
@ -244,6 +250,30 @@
</p>
</field>
</record>
<record id="product_action_template" model="ir.actions.act_window">
<field name="name">Products by Templates</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_type">form</field>
<field name="context">{"search_default_template_id":1, "search_default_filter_to_sell":1}</field>
<field name="view_id" ref="product_product_tree_view"/>
<field name="search_view_id" ref="product_search_form_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the sale
process: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<record id="open_view_product_tree1" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
@ -268,6 +298,7 @@
<menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>
<menuitem action="product.product_normal_action_sell" id="product.menu_products" parent="base.menu_product" sequence="1"/>
<menuitem action="product.product_action_template" id="product.menu_products_bytemplate" parent="base.menu_product" groups="product.group_product_variant"/>
<record id="product_normal_action_puchased" model="ir.actions.act_window">
<field name="name">Products</field>
@ -668,6 +699,18 @@
</record>
<!-- Variants -->
<record id="product_variant_search_form_view" model="ir.ui.view">
<field name="name">product.variant.search.form</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<search string="Product Variant">
<field name="name" string="Product" filter_domain="['|','|',('name','ilike',self),('default_code','ilike',self),('variants','ilike',self)]"/>
<group expand='0' string='Group by...'>
<filter string='Template' name="template_id" domain="[]" context="{'group_by' : 'product_tmpl_id'}"/>
</group>
</search>
</field>
</record>
<record id="product_variant_form_view" model="ir.ui.view">
<field name="name">product.variant.form</field>
<field name="model">product.product</field>
@ -678,7 +721,10 @@
<field name="active"/>
<field name="variants" required="1"/>
<field name="default_code"/>
<field name="price_margin"/>
<label for="price_margin"/>
<div>
<field name="price_margin" class="oe_inline" style="vertical-align:baseline"/> %%
</div>
<field name="price_extra"/>
</group>
</form>
@ -704,12 +750,12 @@
<record id="product_variant_action" model="ir.actions.act_window">
<field name="name">Product Variants</field>
<field name="type">ir.actions.act_window</field>
<!--<field name="domain">[('variants','&lt;&gt;', False)]</field>-->
<field name="domain">[('variants','&lt;&gt;', False)]</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_id" ref="product_variant_tree_view"/>
<field name="search_view_id" ref="product_search_form_view"/>
<field name="search_view_id" ref="product_variant_search_form_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new variant of product.
@ -728,9 +774,30 @@
<field name="view_id" ref="product_variant_form_view"/>
<field name="act_window_id" ref="product_variant_action"/>
</record>
<menuitem action="product.product_variant_action" id="product.menu_variant_product" parent="base.menu_product" sequence="100" groups="product.group_product_variant"/>
<menuitem action="product.product_variant_action" id="product.menu_variant_product" parent="prod_config_main" sequence="100" groups="product.group_product_variant"/>
<!-- templates -->
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<search string="Product Template">
<field name="name" string="Product"/>
<filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
<filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
<separator/>
<filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
<field name="categ_id"/>
<group expand='0' string='Group by...'>
<filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'categ_id'}"/>
<filter string='Default Unit of Measure' icon="terp-mrp" domain="[]" context="{'group_by' : 'uom_id'}"/>
<filter string='Type' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'type'}"/>
</group>
</search>
</field>
</record>
<record id="product_template_tree_view" model="ir.ui.view">
<field name="name">product.template.product.tree</field>
<field name="model">product.template</field>
@ -740,6 +807,7 @@
<field name="categ_id"/>
<field name="type"/>
<field name="state"/>
<field name="uom_id" invisible="1"/>
</tree>
</field>
</record>
@ -762,81 +830,85 @@
<h2><field name="categ_id"/></h2>
<label for="public_categ_id" class="oe_edit_only"/>
<h3><field name="public_categ_id"/></h3>
<div name="options" groups="base.group_user">
<field name="sale_ok"/>
<label for="sale_ok"/>
</div>
</div>
<notebook>
<page string="Information">
<group>
<group string="Product Type">
<field name="sale_ok"/>
<group colspan="4">
<group>
<field name="type"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="list_price"/>
</group>
<group string="Procurement">
<field name="type"/>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group string="Base Prices">
<field name="list_price"/>
</group>
<group colspan="4" string="Product Variants">
<field colspan="4" name="product_variant_ids" nolabel="1">
<tree string="Product Variants" editable="bottom">
<field name="variants" required="1"/>
<field name="price_margin" string="Variant Price Margin(%%)"/>
<field name="price_extra"/>
<field name="lst_price" string="Sale Price"/>
</tree>
</field>
</group>
<field name="description" placeholder="describe the product characteristics..."/>
</page>
<page string="Procurements" groups="base.group_user">
<group name="procurement">
<group name="general">
<field name="cost_method" groups="product.group_costing_method"/>
<field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
<field name="cost_method"/>
</group>
<group string="Weights">
<group name="delay" string="Delays">
<label for="produce_delay"/>
<div>
<field name="produce_delay" class="oe_inline" style="vertical-align:baseline"/> days
</div>
</group>
<group name="procurement_uom" groups="product.group_uom" string="Purchase">
<field name="uom_po_id"/>
</group>
</group>
<separator string="Suppliers"/>
<field name="seller_ids"/>
<separator string="Description for Suppliers"/>
<field name="description_purchase" placeholder="This note will be displayed on requests for quotation..."/>
</page>
<page string="Inventory">
<group name="inventory">
<group name="status" string="Status">
<field name="state"/>
<field name="product_manager"/>
</group>
<group name ="weight" string="Weights">
<field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="weight" attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
</group>
<group name="status" string="Status">
<field name="categ_id"/>
<field name="state"/>
<field name="product_manager" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_manager']}"/>
</group>
<group name="uom" string="Unit of Measure">
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="uom_po_id"/>
</group>
</page>
<page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}">
<group name="sale">
<group name="sale_condition" string="Sale Conditions">
<label for="warranty"/>
<div>
<field name="warranty" class="oe_inline" style="vertical-align:baseline"/> months
</div>
</group>
<group name="uos" groups="product.group_uom" string="Second Unit of Measure">
<group groups="product.group_uos" string="Unit of Measure">
<field name="uos_id"/>
<field name="uos_coeff"/>
<field name="mes_type"/>
</group>
<group colspan="4" string="Product Variants">
<field colspan="4" name="product_variant_ids" nolabel="1">
<tree string="Product Variants" editable="bottom">
<field name="active"/>
<field name="variants" required="1"/>
<field name="default_code"/>
<field name="price_margin"/>
<field name="price_extra"/>
</tree>
</field>
</group>
</group>
</page>
<page string="Procurement &amp; Locations">
<group>
<group name="delay" string="Delays">
<label for="produce_delay"/>
<div>
<field name="produce_delay" class="oe_inline"/> days
</div>
<field name="warranty"/>
</group>
</group>
</page>
<page string="Suppliers">
<field name="seller_ids"/>
</page>
<page string="Descriptions">
<separator string="Internal Description"/>
<field name="description"/>
<separator string="Sale Description"/>
<field name="description_sale"/>
<separator string="Purchase Description"/>
<field name="description_purchase"/>
<separator string="Description for Quotations"/>
<field name="description_sale" placeholder="note to be displayed on quotations..."/>
</page>
</notebook>
</sheet>
@ -844,13 +916,48 @@
</field>
</record>
<record id="product_template_action_tree" model="ir.actions.act_window">
<record model="ir.ui.view" id="product_template_kanban_view">
<field name="name">Product Template Kanban</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<kanban>
<field name="image_small"/>
<field name="list_price"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_vignette oe_semantic_html_override">
<a type="open"><img t-att-src="kanban_image('product.template', 'image_small', record.id.value)" class="oe_kanban_image"/></a>
<div class="oe_kanban_details">
<h4>
<a type="open">
<field name="name"/>
</a>
</h4>
<div name="tags"/>
<ul>
<li>Price: <field name="list_price"></field></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="product_template_action" model="ir.actions.act_window">
<field name="name">Product Templates</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="view_id" ref="product_template_tree_view"/>
<field name="view_id" ref="product_template_kanban_view"/>
</record>
<menuitem action="product_template_action"
groups="product.group_product_variant"
id="menu_product_template_action"
parent="prod_config_main" sequence="3"/>
</data>
</openerp>

View File

@ -0,0 +1,22 @@
-
I create a Product Template "Tablate PC" with variant "2GB, Wi-Fi , 6in and set Variant Price Margin(%) = 10 and Variant Price Extra = 30."
-
!record {model: product.template, id: product_template_test1}:
name: Tablate PC
type: service
categ_id: product_category_8
uom_id: product_uom_unit
uom_po_id: product_uom_unit
product_variant_ids:
- variants: 2GB, Wi-Fi , 6in
list_price: 20.0
price_margin: 10.0
price_extra: 30.0
-
Now I check new sale price after setting price margins and price extra is equal to (20 + ((20 * 10) / 100)) + 30.
-
!python {model: product.template}: |
template = self.browse(cr, uid, ref("product_template_test1"))
for variant_id in template.product_variant_ids:
product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context)
assert product.lst_price == (20 + ((20 * 10) / 100)) + 30, "Sell price is not correspond."

View File

@ -594,14 +594,26 @@
</field>
</record>
<record id="product_template_search_view_purchase" model="ir.ui.view">
<field name="name">product.template.search.purchase</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<filter name="filter_to_sell" position="after">
<filter name="filter_to_purchase" string="Can be Purchased" icon="terp-accessories-archiver+" domain="[('purchase_ok', '=', 1)]"/>
</filter>
</field>
</record>
<record id="view_template_purchase_ok_form" model="ir.ui.view">
<field name="name">product.template.purchase.ok.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="sale_ok" position="after">
<div name="options" position="inside">
<field name="purchase_ok"/>
</field>
<label for="purchase_ok"/>
</div>
</field>
</record>
<record model="ir.actions.act_window" id="action_purchase_line_product_tree">

View File

@ -318,7 +318,7 @@ Thanks!</field>
<!-- sale advance demo.. -->
<!-- Demo Data for Product -->
<record id="advance_product_0" model="product.product">
<record id="advance_template_0" model="product.template">
<field name="name">Advance</field>
<field name="categ_id" ref="product.product_category_1"/>
<field name="type">service</field>
@ -330,7 +330,10 @@ Thanks!</field>
<field name="company_id" eval="[]"/>
<field name="image">/9j/4AAQSkZJRgABAQEASABIAAD/2w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HbXn3J2g/LpEzjX9H//2Q==</field>
</record>
<record id="advance_product_0" model="product.product">
<field name="product_tmpl_id" ref="advance_template_0"/>
</record>
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('base.group_sale_salesman'))]" name="groups_id"/>
</record>

View File

@ -37,29 +37,30 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<group name="delay" position="inside">
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',False)]}"/>
</group>
<group name="delay" position="after">
<group name="store" string="Storage Location">
<xpath expr="//group[@name='sale_condition']" position="inside">
<label for="sale_delay"/>
<div>
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',False)]}" class="oe_inline" style="vertical-align:baseline"/> days
</div>
</xpath>
<xpath expr="//group[@name='status']" position="after">
<group name="store" string="Storage Location">
<field name="loc_rack"/>
<field name="loc_row"/>
<field name="loc_case"/>
</group>
</group>
<page position="after" string="Information">
<page string="Properties">
<group string="Counter-Part Locations Properties" groups="stock.group_locations">
<field name="property_stock_procurement" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" domain="[('usage','=','inventory')]"/>
</group>
<group string="Accounting Entries">
<field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</group>
</page>
</page>
<field name="loc_case"/>
</group>
</xpath>
<xpath expr="//group[@name='weight']" position="after">
<group string="Accounting Entries">
<field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</group>
<group string="Counter-Part Locations Properties" groups="stock.group_locations">
<field name="property_stock_procurement" domain="[('usage','=','procurement')]"/>
<field name="property_stock_production" domain="[('usage','=','production')]"/>
<field name="property_stock_inventory" domain="[('usage','=','inventory')]"/>
</group>
</xpath>
<field name="product_manager" position="attributes" version="7.0">
<attribute name="context">{'default_groups_ref': ['base.group_user', 'base.group_sale_manager', 'stock.group_stock_manager']}</attribute>
</field>
@ -138,7 +139,7 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="standard_price" position="replace" version="7.0">
<label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user"/>
<label for="standard_price" align="1.0" groups="base.group_user"/>
<div groups="base.group_user">
<field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}" nolabel="1"/>
<button name="%(action_view_change_standard_price)d" string="- update"