Use untaxed amount in name_get of purchase orders
Add sum for qty in operation lines
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo.tools.misc import formatLang
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
@@ -54,6 +55,20 @@ class PurchaseOrder(models.Model):
|
||||
self, 'purchase.report_purchaseorder')
|
||||
return action
|
||||
|
||||
# Re-write native name_get() to use amount_untaxed instead of amount_total
|
||||
@api.multi
|
||||
@api.depends('name', 'partner_ref')
|
||||
def name_get(self):
|
||||
result = []
|
||||
for po in self:
|
||||
name = po.name
|
||||
if po.partner_ref:
|
||||
name += ' ('+po.partner_ref+')'
|
||||
if po.amount_untaxed:
|
||||
name += ': ' + formatLang(self.env, po.amount_untaxed, currency_obj=po.currency_id)
|
||||
result.append((po.id, name))
|
||||
return result
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
@@ -32,6 +32,13 @@
|
||||
<button name="action_cancel" type="object" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to cancel this picking?</attribute>
|
||||
</button>
|
||||
<!-- This sum is useful to check the 'number of items' to transfer... -->
|
||||
<xpath expr="//field[@name='pack_operation_product_ids']/tree/field[@name='product_qty']" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='pack_operation_product_ids']/tree/field[@name='qty_done']" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user