Use the new product.default_uom.category keyword to search on uom
This commit is contained in:
1 parent
ec44501e63
commit
6cf42e0296
1 file changed
+2
-34
+2
-34
@@ -1259,7 +1259,8 @@ class InvoiceLine(OSV):
|
||||
states={
|
||||
'required': "product",
|
||||
'invisible': "type != 'line'",
|
||||
}, domain="[('category', '=', (product, 'product'))]")
|
||||
}, domain="[('category', '=', " \
|
||||
"(product, 'product.default_uom.category'))]")
|
||||
unit_digits = fields.Function('get_unit_digits', type='integer',
|
||||
string='Unit Digits', on_change_with=['unit'])
|
||||
product = fields.Many2One('product.product', 'Product',
|
||||
@@ -1995,39 +1996,6 @@ class Template(OSV):
|
||||
Template()
|
||||
|
||||
|
||||
class Uom(OSV):
|
||||
_name = 'product.uom'
|
||||
|
||||
def search(self, cursor, user, args, offset=0, limit=None, order=None,
|
||||
context=None, count=False, query_string=False):
|
||||
product_obj = self.pool.get('product.product')
|
||||
args = args[:]
|
||||
def process_args(args):
|
||||
i = 0
|
||||
while i < len(args):
|
||||
if isinstance(args[i], list):
|
||||
process_args(args[i])
|
||||
if isinstance(args[i], tuple) \
|
||||
and args[i][0] == 'category' \
|
||||
and isinstance(args[i][2], (list, tuple)) \
|
||||
and len(args[i][2]) == 2 \
|
||||
and args[i][2][1] == 'product':
|
||||
if not args[i][2][0]:
|
||||
args[i] = ('id', '!=', '0')
|
||||
else:
|
||||
product = product_obj.browse(cursor, user,
|
||||
args[i][2][0], context=context)
|
||||
category_id = product.default_uom.category.id
|
||||
args[i] = (args[i][0], args[i][1], category_id)
|
||||
i += 1
|
||||
process_args(args)
|
||||
return super(Uom, self).search(cursor, user, args, offset=offset,
|
||||
limit=limit, order=order, context=context, count=count,
|
||||
query_string=query_string)
|
||||
|
||||
Uom()
|
||||
|
||||
|
||||
class FiscalYear(OSV):
|
||||
_name = 'account.fiscalyear'
|
||||
out_invoice_sequence = fields.Many2One('ir.sequence.strict',
|
||||
|
||||
Reference in new issue
Block a user