Integer, Numeric and Float allow None as value
NULL value is None and not False issue2022 review237004
This commit is contained in:
1 parent
097c8476b2
commit
200bd670e6
5 files changed
+43
-28
No files matched your search
+3
-3
@@ -209,11 +209,11 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
uom = fields.Function(fields.Many2One('product.uom', 'UOM'), 'get_uom')
|
||||
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
||||
'get_unit_digits')
|
||||
expected_quantity = fields.Float('Expected Quantity',
|
||||
expected_quantity = fields.Float('Expected Quantity', required=True,
|
||||
digits=(16, Eval('unit_digits', 2)), readonly=True,
|
||||
depends=['unit_digits'])
|
||||
quantity = fields.Float('Quantity', digits=(16, Eval('unit_digits', 2)),
|
||||
depends=['unit_digits'])
|
||||
quantity = fields.Float('Quantity', required=True,
|
||||
digits=(16, Eval('unit_digits', 2)), depends=['unit_digits'])
|
||||
move = fields.Many2One('stock.move', 'Move', readonly=True)
|
||||
inventory = fields.Many2One('stock.inventory', 'Inventory', required=True,
|
||||
ondelete='CASCADE')
|
||||
|
||||
+4
-4
@@ -142,23 +142,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_inventory">
|
||||
<field name="name">Inventory</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="inventory_act_draft">
|
||||
<field name="workflow" ref="wkf_inventory"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="method">wkf_draft</field>
|
||||
<field name="name">Draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="inventory_act_cancel">
|
||||
<field name="workflow" ref="wkf_inventory"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="inventory_act_done">
|
||||
<field name="workflow" ref="wkf_inventory"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
|
||||
+10
-1
@@ -1,10 +1,11 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import copy
|
||||
import datetime
|
||||
from decimal import Decimal
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard, StateView, StateAction, Button
|
||||
from trytond.pyson import PYSONEncoder
|
||||
from trytond.pyson import PYSONEncoder, Eval, Or
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.tools import safe_eval, reduce_ids
|
||||
from trytond.pool import Pool
|
||||
@@ -36,6 +37,14 @@ class Template(ModelSQL, ModelView):
|
||||
'change_default_uom': 'You cannot change the default uom for '\
|
||||
'a product which is associated to stock moves.',
|
||||
})
|
||||
self.cost_price = copy.copy(self.cost_price)
|
||||
self.cost_price.states = copy.copy(self.cost_price.states)
|
||||
self.cost_price.states['required'] = Or(
|
||||
self.cost_price.states.get('required', True),
|
||||
Eval('type').in_(['goods', 'assets']))
|
||||
self.cost_price.depends = copy.copy(self.cost_price.depends)
|
||||
self.cost_price.depends.append('type')
|
||||
self._reset_columns()
|
||||
|
||||
def write(self, ids, vals):
|
||||
move_obj = Pool().get('stock.move')
|
||||
|
||||
+20
-20
@@ -714,23 +714,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_shipmentin">
|
||||
<field name="name">Supplier Shipment</field>
|
||||
<field name="model">stock.shipment.in</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentin_act_draft">
|
||||
<field name="workflow" ref="wkf_shipmentin"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="method">wkf_draft</field>
|
||||
<field name="name">Draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentin_act_cancel">
|
||||
<field name="workflow" ref="wkf_shipmentin"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentin_act_done">
|
||||
<field name="workflow" ref="wkf_shipmentin"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
@@ -779,23 +779,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_shipmentout">
|
||||
<field name="name">Customer Shipment</field>
|
||||
<field name="model">stock.shipment.out</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentout_act_draft">
|
||||
<field name="workflow" ref="wkf_shipmentout"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="name">Draft</field>
|
||||
<field name="method">wkf_draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentout_act_cancel">
|
||||
<field name="workflow" ref="wkf_shipmentout"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentout_act_done">
|
||||
<field name="workflow" ref="wkf_shipmentout"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
@@ -977,23 +977,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_shipmentinternal">
|
||||
<field name="name">Internal Shipment</field>
|
||||
<field name="model">stock.shipment.internal</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentinternal_act_draft">
|
||||
<field name="workflow" ref="wkf_shipmentinternal"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="method">wkf_draft</field>
|
||||
<field name="name">Draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentinternal_act_cancel">
|
||||
<field name="workflow" ref="wkf_shipmentinternal"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipmentinternal_act_done">
|
||||
<field name="workflow" ref="wkf_shipmentinternal"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
@@ -1083,23 +1083,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_shipment_out_return">
|
||||
<field name="name">Customer Return Shipment</field>
|
||||
<field name="model">stock.shipment.out.return</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_out_return_act_draft">
|
||||
<field name="workflow" ref="wkf_shipment_out_return"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="method">wkf_draft</field>
|
||||
<field name="name">Draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_out_return_act_cancel">
|
||||
<field name="workflow" ref="wkf_shipment_out_return"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_out_return_act_done">
|
||||
<field name="workflow" ref="wkf_shipment_out_return"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
@@ -1147,23 +1147,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="workflow" id="wkf_shipment_in_return">
|
||||
<field name="name">Supplier Return Shipment</field>
|
||||
<field name="model">stock.shipment.in.return</field>
|
||||
<field name="on_create">True</field>
|
||||
<field name="on_create" eval="True"/>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_in_return_act_draft">
|
||||
<field name="workflow" ref="wkf_shipment_in_return"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="flow_start" eval="True"/>
|
||||
<field name="method">wkf_draft</field>
|
||||
<field name="name">Draft</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_in_return_act_cancel">
|
||||
<field name="workflow" ref="wkf_shipment_in_return"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Canceled</field>
|
||||
<field name="method">wkf_cancel</field>
|
||||
</record>
|
||||
<record model="workflow.activity" id="shipment_in_return_act_done">
|
||||
<field name="workflow" ref="wkf_shipment_in_return"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="flow_stop" eval="True"/>
|
||||
<field name="name">Done</field>
|
||||
<field name="method">wkf_done</field>
|
||||
</record>
|
||||
|
||||
@@ -63,6 +63,8 @@ class StockTestCase(unittest.TestCase):
|
||||
product_id = self.product.create({
|
||||
'name': 'Test Move.internal_quantity',
|
||||
'type': 'goods',
|
||||
'list_price': Decimal(0),
|
||||
'cost_price': Decimal(0),
|
||||
'category': category_id,
|
||||
'cost_price_method': 'fixed',
|
||||
'default_uom': kg_id,
|
||||
@@ -120,6 +122,8 @@ class StockTestCase(unittest.TestCase):
|
||||
product_id = self.product.create({
|
||||
'name': 'Test products_by_location',
|
||||
'type': 'goods',
|
||||
'list_price': Decimal(0),
|
||||
'cost_price': Decimal(0),
|
||||
'category': category_id,
|
||||
'cost_price_method': 'fixed',
|
||||
'default_uom': kg_id,
|
||||
@@ -333,6 +337,8 @@ class StockTestCase(unittest.TestCase):
|
||||
'category': category_id,
|
||||
'cost_price_method': 'fixed',
|
||||
'default_uom': unit_id,
|
||||
'list_price': Decimal(0),
|
||||
'cost_price': Decimal(0),
|
||||
})
|
||||
supplier_id, = self.location.search([('code', '=', 'SUP')])
|
||||
customer_id, = self.location.search([('code', '=', 'CUS')])
|
||||
|
||||
Reference in new issue
Block a user