Fall 5557: Änderungswünsche vom Workshop Termin am 12.04.2018

develop
Ahmed Aly 2018-04-18 12:59:58 +02:00
parent 2411057beb
commit 4b9629d9b0
6 changed files with 42 additions and 16 deletions

View File

@ -393,12 +393,28 @@ class SaleOrderLine(models.Model):
from_designbox = fields.Boolean(string='I', readonly=True, help='Import von externem System')
product_id = fields.Many2one(domain=[('sale_ok', '=', True), ('can_be_sold_unconfigured', '=', True)])
weight = fields.Float(string='Gewicht', compute='_compute_weight')
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code',
compute="_compute_intrastat_id")
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code')
@api.model
def create(self, vals):
if vals.get('intrastat_id', None) is None:
if vals.get('lot_id', False):
vals.update(intrastat_id=self.env['stock.production.lot'].browse(vals['lot_id']).intrastat_id.id)
elif vals.get('product_id', False):
vals.update(intrastat_id=self.env['product.template'].browse(vals['product_id']).intrastat_id.id)
return super(SaleOrderLine, self).create(vals)
@api.multi
def write(self, vals):
for record in self:
lot_id = record.lot_id if 'lot_id' not in vals else vals.get('lot_id', False)
if vals.get('intrastat_id', False) and lot_id:
self.env['stock.production.lot'].browse([vals.get('lot_id', False)]).write({
'intrastat_id': vals.get('intrastat_id')
})
elif vals.get('intrastat_id', False) and not lot_id:
raise UserError(_('Der Intrastrat Code kann nur gesetzt werden wenn ein Lot angegeben wurde.'))
if record.from_designbox and set(vals.keys()).intersection(
['product_uom_qty', 'product_uom', 'price_unit']):
raise ValidationError(_("Menge und Preis können von Produkten aus der Designbox nicht geändert werden"))
@ -430,11 +446,6 @@ class SaleOrderLine(models.Model):
for record in self:
record.weight = record.lot_id.weight or record.product_id.weight
@api.multi
def _compute_intrastat_id(self):
for record in self:
record.intrastat_id = record.lot_id.intrastat_id.id or record.product_id.intrastat_id.id
@api.multi
def _prepare_invoice_line(self, qty):
self.ensure_one()

View File

@ -25,10 +25,16 @@
<field name="assembly_notes"/>
</group>
</field>
<xpath expr="//field[@name='order_line']/form//field[@name='name']" position="after">
<field name="intrastat_id"/>
</xpath>
<xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="after">
<field name="lot_id"/>
<field name="from_designbox"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree//field[@name='name']" position="after">
<field name="intrastat_id"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
<field name="lot_id" options="{'no_open': True}"/>
<button name="action_show_lot" string="Lot" type="object" icon="fa-list"
@ -131,6 +137,7 @@
<filter name="customer" position="after">
<filter string="PG Status" domain="[]" context="{'group_by':'assembly_state'}"/>
<filter string="Rechnungsadresse" domain="[]" context="{'group_by':'partner_invoice_id'}"/>
<filter string="Auftragsart" domain="[]" context="{'group_by':'order_type'}"/>
</filter>
</field>
</record>

View File

@ -138,11 +138,15 @@
<span t-esc="pos_nr"/>
</td>
<td class="text-right">
<span t-esc="o._formatLang(invoice_line.quantity, False).strip('0').strip(',')"/>
<t t-if="invoice_line.quantity">
<span t-esc="o._formatLang(invoice_line.quantity, False).strip('0').strip(',').strip('.')"/>
</t>
</td>
<td class="text-right">
<span t-field="invoice_line.weight"/>
kg
<t t-if="invoice_line.weight">
<span t-field="invoice_line.weight"/>
kg
</t>
</td>
<td class="text-right"/>
<td class="text-left">

View File

@ -127,11 +127,15 @@
<span t-esc="pos_nr"/>
</td>
<td class="text-right">
<span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',')"/>
<t t-if="order_line.product_uom_qty">
<span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',').strip('.')"/>
</t>
</td>
<td class="text-right">
<span t-field="order_line.weight"/>
kg
<t t-if="order_line.weight">
<span t-field="order_line.weight"/>
kg
</t>
</td>
<td class="text-right">
</td>
@ -232,7 +236,7 @@
<span t-esc="o.incoterm.name"/>
<br/>
</p>
<p class="col-xs-12" t-if="o.payment_term_id">
<p class="col-xs-12" t-if="o.payment_term_id and not o.partner_invoice_id.is_retailer">
Zahlungskonditionen:
<span t-esc="o.payment_term_id.name"/>
<br/>

View File

@ -87,7 +87,7 @@ class AccountInvoiceLine(models.Model):
compute='_compute_price_reduce', required=True, store=True,
help='Rabattierter Einzelpreis, inkludiert bereits den Rabatt und ist auf 2 Stellen '
'kaufmännisch gerundet.')
hide_discount = fields.Boolean(string='Rabatt verstecken')
hide_discount = fields.Boolean(string='RV')
@api.multi
@api.depends('price_unit', 'discount')

View File

@ -25,7 +25,7 @@ from odoo.tools import float_round
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
hide_discount = fields.Boolean(string='Rabatt verstecken')
hide_discount = fields.Boolean(string='RV')
@api.multi
@api.depends('product_uom_qty', 'discount', 'price_unit', 'tax_id')