Skip to content
Snippets Groups Projects
Commit 99914c68 authored by Marco Folco's avatar Marco Folco
Browse files

Merge branch 'sale_reports' into '12.0-stage'

[MOD]report_load_note

See merge request !13
parents e5b26741 0de8db72
No related branches found
No related tags found
1 merge request!13[MOD]report_load_note
......@@ -38,6 +38,7 @@
"views/dvh_configurator.xml",
"views/glass_production_order_view.xml",
"views/production_order_view.xml",
"views/product_attribute_views.xml",
"data/data.xml",
"data/ir_sequence_data.xml",
"security/ir.model.access.csv",
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<data noupdate="1">
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(4, ref('product.group_product_variant'))]"/>
</record>
......@@ -48,8 +48,6 @@
<field name="create_variant">no_variant</field>
<field name="glass_type">camera</field>
</record>
</data>
<data noupdate="1">
<record id="product_product_dvh" model="product.product">
<field name="name">DVH</field>
<field name="type">consu</field>
......
......@@ -7,12 +7,14 @@
<field name="attribute_id" ref="product_attribute_color"/>
<field name="sequence">1</field>
<field name="code">01</field>
<field name="alias">Rd</field>
</record>
<record id="product_attribute_color_blue" model="product.attribute.value">
<field name="name">Blue</field>
<field name="attribute_id" ref="product_attribute_color"/>
<field name="sequence">1</field>
<field name="code">02</field>
<field name="alias">Bl</field>
</record>
<!-- Thickness values -->
......@@ -20,13 +22,15 @@
<field name="name">1 mm</field>
<field name="attribute_id" ref="product_attribute_thickness"/>
<field name="sequence">1</field>
<field name="code">01</field>
<field name="code">001</field>
<field name="alias">1</field>
</record>
<record id="product_attribute_thickness_10mm" model="product.attribute.value">
<field name="name">10 mm</field>
<field name="attribute_id" ref="product_attribute_thickness"/>
<field name="sequence">1</field>
<field name="code">10</field>
<field name="code">010</field>
<field name="alias">10</field>
</record>
<!-- Glass Type values -->
......@@ -35,12 +39,14 @@
<field name="attribute_id" ref="product_attribute_glass_type"/>
<field name="sequence">1</field>
<field name="code">01</field>
<field name="alias">F</field>
</record>
<record id="product_attribute_glass_type_laminated" model="product.attribute.value">
<field name="name">Laminated</field>
<field name="attribute_id" ref="product_attribute_glass_type"/>
<field name="sequence">1</field>
<field name="code">02</field>
<field name="alias">L</field>
</record>
<!-- Width values -->
......
......@@ -30,6 +30,7 @@ class ProductAttributeValue(models.Model):
_inherit = 'product.attribute.value'
code = fields.Char(string='Internal Code')
alias = fields.Char(string='Alias')
class ProductTemplate(models.Model):
......@@ -40,6 +41,15 @@ class ProductTemplate(models.Model):
glass_thickness = fields.Many2one('product.attribute.value', string='Thickness')
glass_type = fields.Many2one('product.attribute.value', string='Type')
@api.multi
def get_alias(self):
self.ensure_one()
gc = self.glass_color
gth = self.glass_thickness
gty = self.glass_type
alias = gc.alias + ' ' + gth.alias + ' ' + gty.alias
return alias
@api.constrains('glass_color', 'glass_thickness', 'glass_type')
def _check_attribute_combination(self):
for pte in self:
......
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="variants_tree_view" model="ir.ui.view">
<field name="model">product.attribute.value</field>
<field name="inherit_id" ref="product.variants_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="alias" required="True"/>
<field name="code"/>
</xpath>
</field>
</record>
</data>
</odoo>
......@@ -6,29 +6,27 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='payment_term_id']" position="after">
<field name="internal_type" required="True"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="attrs">{'column_invisible': [('parent.internal_type', '=', 'dvh')]}</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree" position="inside">
<field name="component_ids"
widget="many2many_tags"
readonly="1"
force_save="1"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<field name="camera"
required="True"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<field name="product_modifier_id"/>
<field name="note"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<button name="edit_dvh" type="object" string="Edit DVH" attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<button name="edit_glass" type="object" string="Edit glass" attrs="{'column_invisible': [('parent.internal_type', '=', 'dvh')]}"/>
</xpath>
</data>
<xpath expr="//field[@name='payment_term_id']" position="after">
<field name="internal_type" required="True"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="attrs">{'column_invisible': [('parent.internal_type', '=', 'dvh')]}</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree" position="inside">
<field name="component_ids"
widget="many2many_tags"
readonly="1"
force_save="1"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<field name="camera"
required="True"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<field name="product_modifier_id"/>
<field name="note"
attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<button name="edit_dvh" type="object" string="Edit DVH" attrs="{'column_invisible': [('parent.internal_type', '=', 'standard')]}"/>
<button name="edit_glass" type="object" string="Edit glass" attrs="{'column_invisible': [('parent.internal_type', '=', 'dvh')]}"/>
</xpath>
</field>
</record>
<record model="ir.actions.server" id="sale_order_add_glass">
......
......@@ -68,15 +68,11 @@ class DvhConfigurator(models.TransientModel):
glass_component_ids.append(second_gc.id)
else:
first_gc.qty = 2
# Build the product_code to use in the sale order line
# description
product_code = '[' + first_pp.product_tmpl_id.default_code
if second_pp:
product_code += '-' + second_pp.product_tmpl_id.default_code + ']'
else:
product_code += ']'
first_alias = first_pp.product_tmpl_id.get_alias()
second_alias = second_pp.product_tmpl_id.get_alias() if second_pp else False
measures = self.line_ids[0].height.name + ' X ' + self.line_ids[0].width.name
name = 'DVH ' + product_code + ' - ' + measures
name = (first_alias + ' ' + second_alias) if second_alias else first_alias
name += ' - ' + measures
pm = line.product_modifier_id
if self.edit:
sol.write({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment