sale_stock_usability: add methods for report
move form view in picking: add date field account_usability: amount in tax lines readonly on customer invoices
This commit is contained in:
@@ -41,6 +41,10 @@
|
||||
<xpath expr="//field[@name='tax_line_ids']/tree/field[@name='amount']" position="before">
|
||||
<field name="base" readonly="1"/>
|
||||
</xpath>
|
||||
<!-- Don't allow to force tax amount on CUSTOMER invoices -->
|
||||
<xpath expr="//field[@name='tax_line_ids']/tree/field[@name='amount']" position="attributes">
|
||||
<attribute name="readonly">1</attribute>
|
||||
</xpath>
|
||||
<!-- Warning: there are 2 invoice_print buttons in the native view... probably a bug -->
|
||||
<xpath expr="//button[@name='invoice_print']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('state', 'not in', ('open', 'paid'))]}</attribute>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2020 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields
|
||||
from odoo import fields, models
|
||||
from odoo.tools import float_compare, float_round
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
@@ -11,3 +12,36 @@ class SaleOrder(models.Model):
|
||||
|
||||
warehouse_id = fields.Many2one(track_visibility='onchange')
|
||||
incoterm = fields.Many2one(track_visibility='onchange')
|
||||
|
||||
def report_qty_to_deliver(self):
|
||||
# Can be useful for delivery report
|
||||
self.ensure_one()
|
||||
res = []
|
||||
prec = self.env['decimal.precision'].precision_get(
|
||||
'Product Unit of Measure')
|
||||
for l in self.order_line:
|
||||
if (
|
||||
l.product_id.type in ('product', 'consu') and
|
||||
float_compare(
|
||||
l.product_uom_qty, l.qty_delivered,
|
||||
precision_digits=prec) > 0):
|
||||
qty_to_deliver = float_round(
|
||||
l.product_uom_qty - l.qty_delivered, precision_digits=prec)
|
||||
res.append({
|
||||
'product': l.product_id,
|
||||
'name': l.name,
|
||||
'uom': l.product_uom,
|
||||
'qty_to_deliver': qty_to_deliver,
|
||||
})
|
||||
return res
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def report_qty_to_deliver(self):
|
||||
self.ensure_one()
|
||||
res = []
|
||||
if self.sale_id:
|
||||
res = self.sale_id.report_qty_to_deliver()
|
||||
return res
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
</page>
|
||||
<page string="Advanced Parameters" name="advanced-params" groups="stock.group_stock_manager">
|
||||
<group name="advanced">
|
||||
<field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="procurement_id"/>
|
||||
<field name="group_id"/>
|
||||
|
||||
Reference in New Issue
Block a user