Skip to content

Commit

Permalink
Merge pull request OCA#35 from gurneyalex/master
Browse files Browse the repository at this point in the history
fix PR33
  • Loading branch information
guewen authored Mar 17, 2017
2 parents 2eee944 + 53aff5a commit 1e702c1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
12 changes: 8 additions & 4 deletions odoo/local-src/specific_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class SaleOrder(models.Model):
string='Sales Condition',
required=True,
attachment=True,
states={'draft': [('required', False)]}
copy=True,
states={'draft': [('required', False)],
'cancel': [('required', False)]}
)
sales_condition_filename = fields.Char()

Expand Down Expand Up @@ -148,11 +150,13 @@ def _check_validators(self):

def write(self, vals):
# from ' draft you can switch only to 'final_quote'
target_state = vals.get('state', 'final_quote')
if (self.state == 'draft' and
vals.get('state', 'final_quote') != 'final_quote'):
target_state not in ('cancel', 'final_quote')):
raise UserError(
'A Draft Sale Order can only step to "final_quote" ')
if vals.get('state', 'draft') != 'draft':
_('A Draft Sale Order can only step to '
'"final_quote" or "cancel"'))
if vals.get('state', 'draft') not in ('cancel', 'draft'):
self._check_ghost()
self._check_sales_condition()
self._check_validators()
Expand Down
14 changes: 0 additions & 14 deletions odoo/local-src/specific_sale/views/product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,4 @@
</field>
</record>

<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.ghost.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<div name="options" position="inside">
<div>
<field name="is_ghost"/>
<label for="is_ghost"/>
</div>
</div>
</field>
</record>

</odoo>
26 changes: 17 additions & 9 deletions odoo/local-src/specific_sale/views/sale_order_crm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,23 @@

<notebook position="inside">
<page string="RocTool" name="roctool">
<group name="project_name_computation" string="Project configuration">
<field name="project_zone_id"/>
<field name="project_process_id"/>
<field name="project_market_id"/>
<field name='sales_condition' filename="sales_condition_filename"/>
<field name='sales_condition_filename' invisible="1"/>
<field name='engineering_validation_id'/>
<field name='system_validation_id'/>
<field name='process_validation_id'/>
<group>
<group name="project_name_computation" string="Project configuration">
<field name="project_zone_id"/>
<field name="project_process_id"/>
<field name="project_market_id"/>
</group>
<group name="sales_condition" string="Sales Conditions">
<field name='sales_condition' filename="sales_condition_filename"/>
<field name='sales_condition_filename' invisible="1"/>
</group>
</group>
<group>
<group name="validation" string="Validation">
<field name='engineering_validation_id'/>
<field name='system_validation_id'/>
<field name='process_validation_id'/>
</group>
</group>
</page>
</notebook>
Expand Down
1 change: 1 addition & 0 deletions odoo/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ migration:
upgrade:
- specific_crm
- specific_sale
- sale_order_revision

0 comments on commit 1e702c1

Please sign in to comment.