change behaviour of global dicount (allow use for draft & sent)
Display weight in order_view correct misspellingdevelop
parent
60665a2738
commit
408c64df44
|
|
@ -6,11 +6,11 @@ from odoo.exceptions import UserError
|
|||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
global_discount = fields.Boolean("Add Global Discount", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
global_discount = fields.Boolean("Add Global Discount", readonly=True, states={'draft': [('readonly', False),],'sent': [('readonly', False)]},)
|
||||
discount_type = fields.Selection([('fixed','Fixed'),('percentage','Percentage')],
|
||||
"Discount Type", readonly=True, states={'draft': [('readonly', False)]}, default='fixed')
|
||||
discount_amount = fields.Float("Discount Amount", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_percentage = fields.Float("Discount Percentage", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
"Discount Type", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]}, default='percentage')
|
||||
discount_amount = fields.Float("Discount Amount", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]},)
|
||||
discount_percentage = fields.Float("Discount Percentage", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]},)
|
||||
|
||||
@api.multi
|
||||
def _discount_unset(self):
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='payment_term_id']" position="after">
|
||||
<label for="global_discount"/>
|
||||
<label for="global_discount" attrs="{'invisible': [('state','!=', 'draft'),('state','!=', 'sent')]}"/>
|
||||
<div name='global_discount'>
|
||||
<div>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft'),('state','!=', 'sent')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False),'&', ('state','!=', 'draft'),('state','!=', 'sent')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False),('discount_type','!=','fixed'),'&', ('state','!=', 'draft'),('state','!=', 'sent')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False),('discount_type','!=','percentage'),'&', ('state','!=', 'draft'),('state','!=', 'sent')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link oe_edit_only" attrs="{'invisible': ['|',('state','not in', ['draft','sent']),('global_discount','=', False)]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ProductXCategory(models.Model):
|
|||
_description = 'X-Kategorie'
|
||||
_order = 'name'
|
||||
|
||||
name = fields.Char(string='Bezaichnung', required=True)
|
||||
name = fields.Char(string='Bezeichnung', required=True)
|
||||
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein')
|
||||
|
|
|
|||
|
|
@ -66,6 +66,14 @@ class SaleOrder(models.Model):
|
|||
pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False)
|
||||
pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False)
|
||||
|
||||
@api.multi
|
||||
def _reset_sequence(self):
|
||||
for rec in self:
|
||||
current_sequence = 1
|
||||
for line in rec.order_line:
|
||||
line.sequence = current_sequence
|
||||
current_sequence += 1
|
||||
|
||||
@api.multi
|
||||
def _pg9_call(self):
|
||||
for record in self:
|
||||
|
|
@ -347,6 +355,8 @@ class SaleOrder(models.Model):
|
|||
if vals.get('message_post',False):
|
||||
self.message_post(body=vals.get('message_post'))
|
||||
|
||||
self._reset_sequence()
|
||||
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
|
@ -493,6 +503,23 @@ class SaleOrderLine(models.Model):
|
|||
product_id = fields.Many2one(domain=_get_product_id_domain)
|
||||
weight = fields.Float(string='Gewicht', compute='_compute_weight')
|
||||
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code')
|
||||
sequence = fields.Integer(string='Sequence', default=9999)
|
||||
|
||||
@api.multi
|
||||
@api.onchange('product_id')
|
||||
def product_id_change(self):
|
||||
result = super(SaleOrderLine,self).product_id_change()
|
||||
product = self.product_id.with_context(
|
||||
lang=self.order_id.partner_id.lang,
|
||||
partner=self.order_id.partner_id.id
|
||||
)
|
||||
|
||||
name = product.name
|
||||
if product.description_sale:
|
||||
name = product.description_sale
|
||||
self.name = name
|
||||
|
||||
return result
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
<field name="city"/>
|
||||
<field name="ref"/>
|
||||
<field name="portal_id" string="PID"/>
|
||||
<field name="type"/>
|
||||
</field>
|
||||
<field name="email" position="replace">
|
||||
<field name="email" invisible="1"/>
|
||||
|
|
|
|||
|
|
@ -29,8 +29,12 @@
|
|||
<field name="pg9_call_T" widget="url" text="...gehe zu Auftrag in PG9"
|
||||
attrs="{'invisible': ['|','|',('order_type','!=', 'T'),('assembly_state','not in',['wait','started','done','packed','delivered'])]}"/>
|
||||
</field>
|
||||
<field name="note" position="before">
|
||||
<label for="weight_total">Gesamtgewicht: </label>
|
||||
<field name="weight_total"/>
|
||||
<div class="oe_clear"/>
|
||||
</field>
|
||||
<field name="note" position="after">
|
||||
<separator/>
|
||||
<group name="internal_notes" string="Notizen">
|
||||
<field name="internal_notes"/>
|
||||
</group>
|
||||
|
|
|
|||
Loading…
Reference in New Issue