mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-10-25 23:40:05 -05:00
[PATCH] Upstream patch - 20092023
This commit is contained in:
1 parent
7226ea43fc
commit
c18ec76a1c
3 files changed
+30
-4
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//p[@name='note']" position="replace">
|
||||
<p name="note">
|
||||
<t t-if="o.move_type == 'out_invoice' and o.fiscal_position_id.note">
|
||||
<t t-if="o.company_id.country_id.code == 'IT' and o.fiscal_position_id.note">
|
||||
<span t-field="o.fiscal_position_id.note"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
|
||||
@@ -601,7 +601,10 @@ class ProductTemplate(models.Model):
|
||||
tracking = fields.Selection([
|
||||
('serial', 'By Unique Serial Number'),
|
||||
('lot', 'By Lots'),
|
||||
('none', 'No Tracking')], string="Tracking", help="Ensure the traceability of a storable product in your warehouse.", default='none', required=True)
|
||||
('none', 'No Tracking')],
|
||||
string="Tracking", required=True, default='none',
|
||||
compute='_compute_tracking', store=True, readonly=False,
|
||||
help="Ensure the traceability of a storable product in your warehouse.")
|
||||
description_picking = fields.Text('Description on Picking', translate=True)
|
||||
description_pickingout = fields.Text('Description on Delivery Orders', translate=True)
|
||||
description_pickingin = fields.Text('Description on Receptions', translate=True)
|
||||
@@ -688,6 +691,12 @@ class ProductTemplate(models.Model):
|
||||
}
|
||||
return prod_available
|
||||
|
||||
@api.depends('type')
|
||||
def _compute_tracking(self):
|
||||
self.filtered(
|
||||
lambda t: not t.tracking or t.type in ('consu', 'service') and t.tracking != 'none'
|
||||
).tracking = 'none'
|
||||
|
||||
@api.model
|
||||
def _get_action_view_related_putaway_rules(self, domain):
|
||||
return {
|
||||
@@ -744,8 +753,6 @@ class ProductTemplate(models.Model):
|
||||
@api.onchange('type')
|
||||
def _onchange_type(self):
|
||||
res = super(ProductTemplate, self)._onchange_type() or {}
|
||||
if self.type == 'consu' and self.tracking != 'none':
|
||||
self.tracking = 'none'
|
||||
|
||||
# Return a warning when trying to change the product type
|
||||
if self.ids and self.product_variant_ids.ids and self.env['stock.move.line'].sudo().search_count([
|
||||
|
||||
@@ -276,3 +276,22 @@ class TestVirtualAvailable(TestStockCommon):
|
||||
res = self.env['product.template'].name_search(name='123', operator='not ilike')
|
||||
res_ids = [r[0] for r in res]
|
||||
self.assertNotIn(template.id, res_ids)
|
||||
|
||||
def test_change_type_tracked_product(self):
|
||||
product = self.env['product.template'].create({
|
||||
'name': 'Brand new product',
|
||||
'type': 'product',
|
||||
'tracking': 'serial',
|
||||
})
|
||||
product_form = Form(product)
|
||||
product_form.type = 'service'
|
||||
product = product_form.save()
|
||||
self.assertEqual(product.tracking, 'none')
|
||||
|
||||
product.type = 'product'
|
||||
product.tracking = 'serial'
|
||||
self.assertEqual(product.tracking, 'serial')
|
||||
product_form = Form(product.product_variant_id)
|
||||
product_form.type = 'service'
|
||||
product = product_form.save()
|
||||
self.assertEqual(product.tracking, 'none')
|
||||
Reference in new issue
Block a user