res_users: new field clerk; res_partner: make pricelist mandatory and stored; sale: new field clerk, change to SST-3 (add. lines from previous sales.order)
parent
c97334b54e
commit
0a5b8ca6b5
|
|
@ -64,6 +64,7 @@
|
|||
'views/product_views.xml',
|
||||
'views/ir_attachment_views.xml',
|
||||
'views/res_company_views.xml',
|
||||
'views/res_users_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
|||
|
|
@ -78,6 +78,12 @@ class Partner(models.Model):
|
|||
partner_flash = fields.Char()
|
||||
fax = fields.Char(string='Fax')
|
||||
|
||||
# make pricelist searchable (store=True) --> code copied from: \ext\odoo\addons\product\models\res_partner.py!
|
||||
property_product_pricelist = fields.Many2one(
|
||||
'product.pricelist', 'Sale Pricelist', compute='_compute_product_pricelist', store=True, required=True,
|
||||
inverse="_inverse_product_pricelist", company_dependent=False, # NOT A REAL PROPERTY
|
||||
help="This pricelist will be used, instead of the default one, for sales to the current partner")
|
||||
|
||||
_sql_constraints = [
|
||||
('ref_uniq', 'unique(ref)', 'Die Interne Referenz muss eindeutig sein'),
|
||||
('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein')
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
|
||||
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import api, models, fields
|
||||
|
||||
|
||||
class Users(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
clerk_name = fields.Char('Sachbearbeiter-ID', size=20, help='ID als Sachbearbeiter im PG9 (max. 20 Zeichen)')
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
vals['customer'] = False
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class SaleOrder(models.Model):
|
|||
weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total')
|
||||
confirmation_nr = fields.Char('Freigabenummer')
|
||||
order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M')
|
||||
clerk_id = fields.Many2one('res.users', string='Sachbearbeiter', domain=[('clerk_name', '!=', '')])
|
||||
|
||||
# pg9_call = fields.Char(string='PG9-Auftrag', compute='_pg9_call', store=False)
|
||||
pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False)
|
||||
|
|
@ -324,7 +325,9 @@ class SaleOrder(models.Model):
|
|||
'price_unit': vals['price_unit'],
|
||||
'product_uom_qty': vals['product_uom_qty'],
|
||||
'lot_id': lot_id,
|
||||
'from_designbox': True,
|
||||
'discount': vals.get('discount', 0),
|
||||
'hide_discount': vals.get('hide_discount', False),
|
||||
'from_designbox': vals.get('from_designbox',True),
|
||||
}))
|
||||
return order_lines
|
||||
|
||||
|
|
@ -360,7 +363,7 @@ class SaleOrder(models.Model):
|
|||
def _get_specified_fields(self):
|
||||
return ['origin', 'client_order_ref', 'note', 'date_order', 'assembled', 'line_id', 'partner_id',
|
||||
'fiscal_position_id', 'user_id', 'payment_term_id', 'partner_delivery_id', 'partner_invoice_id',
|
||||
'assembly_state', 'confirmation_nr', 'confirm_order', 'order_type', 'internal_notes']
|
||||
'assembly_state', 'confirmation_nr', 'confirm_order', 'order_type', 'internal_notes', 'from_designbox', 'discount', 'hide_discount']
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
|
|
@ -529,6 +532,8 @@ class SaleOrderLine(models.Model):
|
|||
sequence = fields.Integer(string='Sequence', default=9999)
|
||||
item_notes = fields.Text(string='Notes', related='lot_id.notes', store=False)
|
||||
item_warn = fields.Boolean(string='Notes!!!', compute='_compute_item_warn', store=False)
|
||||
price_change = fields.Boolean(string='R', help='Preis aus Artikelstamm auslesen',default=False, store=False, track_visibility='always')
|
||||
read_price = fields.Boolean(string='R',default=False, store=False, help='Preis aus Artikelstamm auslesen', track_visibility='always')
|
||||
|
||||
@api.multi
|
||||
def _compute_item_warn(self):
|
||||
|
|
@ -552,6 +557,18 @@ class SaleOrderLine(models.Model):
|
|||
|
||||
return result
|
||||
|
||||
@api.onchange('product_uom_qty','read_price')
|
||||
def product_uom_change(self):
|
||||
save_price_unit = self.price_unit
|
||||
result = super(SaleOrderLine,self).product_uom_change()
|
||||
if save_price_unit != self.price_unit:
|
||||
self.price_change = True
|
||||
if not self.read_price:
|
||||
self.price_unit = save_price_unit
|
||||
else:
|
||||
self.price_change = False
|
||||
self.read_price = False
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if not vals.get('intrastat_id', False):
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
<field name="inherit_id" ref="base.view_res_partner_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="property_product_pricelist" string="Preisliste"/>
|
||||
<field name="portal_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="street"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="res_users_form_clerk" model="ir.ui.view">
|
||||
<field name="name">res.users.form.clerk</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="clerk_name"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -61,6 +61,10 @@
|
|||
<field name="product_id" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
-->
|
||||
<xpath expr="//field[@name='order_line']/tree" position="attributes">
|
||||
<attribute name="decoration-danger">price_change == True</attribute>
|
||||
<attribute name="decoration-bf">price_change == True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="replace">
|
||||
<field name="product_id"
|
||||
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
|
||||
|
|
@ -101,6 +105,17 @@
|
|||
-->
|
||||
<field name="from_designbox"/>
|
||||
</xpath>
|
||||
<!--
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="replace">
|
||||
<field name="price_unit"
|
||||
attrs="{'readonly': [('qty_invoiced', '>', 0)]}" options='{"fg_color": "red:price_change" }'/>
|
||||
</xpath>
|
||||
-->
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
|
||||
<field name="read_price" options='{"bg_color": "yellow:price_change" }' attrs="{'invisible': False}"/>
|
||||
<!-- <field name="read_price" colors="yellow:price_change==True"/> -->
|
||||
<field name="price_change" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/kanban//field[@name='product_id']" position="after">
|
||||
<field name="lot_id"/>
|
||||
<field name="from_designbox"/>
|
||||
|
|
@ -116,6 +131,7 @@
|
|||
<group name="production" string="Produktion">
|
||||
<field name="assembled"/>
|
||||
<field name="line_id"/>
|
||||
<field name="clerk_id" options="{'no_create': True, 'no_open': True}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='carrier_id']" position="replace"/>
|
||||
|
|
@ -216,6 +232,7 @@
|
|||
<filter string="Rechnungsadresse" domain="[]" context="{'group_by':'partner_invoice_id'}"/>
|
||||
<filter string="Auftragsart" domain="[]" context="{'group_by':'order_type'}"/>
|
||||
<filter string="Vertriebskanal" domain="[]" context="{'group_by':'team_id'}"/>
|
||||
<filter string="Sachbearbeiter" domain="[]" context="{'group_by' : 'clerk_id'}" />
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
Loading…
Reference in New Issue