@@ -1,3 +1,5 @@
|
||||
* Allow searching reporting records by name
|
||||
|
||||
Version 6.6.0 - 2022-10-31
|
||||
--------------------------
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
@@ -150,6 +150,13 @@ class Agent(ModelView, ModelSQL):
|
||||
def get_currency(self, name):
|
||||
return self.agent.currency.id
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.agent.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('agent.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class AgentTimeseries(Agent):
|
||||
"Commission Reporting per Agent"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Allow searching reporting records by name
|
||||
|
||||
Version 6.6.0 - 2022-10-31
|
||||
--------------------------
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
@@ -281,6 +281,10 @@ class SupplierMixin(object):
|
||||
def get_rec_name(self, name):
|
||||
return self.supplier.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('supplier.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Supplier(SupplierMixin, Abstract, ModelView):
|
||||
"Purchase Reporting per Supplier"
|
||||
@@ -352,6 +356,10 @@ class ProductMixin(object):
|
||||
name += '@%s' % supplier.rec_name
|
||||
return name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('product.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Product(ProductMixin, Abstract, ModelView):
|
||||
"Purchase Reporting per Product"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Allow searching reporting records by name
|
||||
|
||||
Version 6.6.0 - 2022-10-31
|
||||
--------------------------
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
@@ -352,6 +352,10 @@ class CustomerMixin(object):
|
||||
def get_rec_name(self, name):
|
||||
return self.customer.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('customer.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Customer(CustomerMixin, Abstract, ModelView):
|
||||
"Sale Reporting per Customer"
|
||||
@@ -436,6 +440,10 @@ class CustomerCategoryMixin:
|
||||
def get_rec_name(self, name):
|
||||
return self.category.rec_name if self.category else None
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('category.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class CustomerCategory(CustomerCategoryMixin, Abstract, ModelView):
|
||||
"Sale Reporting per Customer Category"
|
||||
@@ -466,7 +474,8 @@ class CustomerCategoryTree(ModelSQL, ModelView):
|
||||
"Sale Reporting per Customer Category"
|
||||
__name__ = 'sale.reporting.customer.category.tree'
|
||||
|
||||
name = fields.Function(fields.Char("Name"), 'get_name')
|
||||
name = fields.Function(
|
||||
fields.Char("Name"), 'get_name', searcher='search_name')
|
||||
parent = fields.Many2One('sale.reporting.customer.category.tree', "Parent")
|
||||
children = fields.One2Many(
|
||||
'sale.reporting.customer.category.tree', 'parent', "Children")
|
||||
@@ -494,6 +503,12 @@ class CustomerCategoryTree(ModelSQL, ModelView):
|
||||
categories = Category.browse(categories)
|
||||
return {c.id: c.name for c in categories}
|
||||
|
||||
@classmethod
|
||||
def search_name(cls, name, clause):
|
||||
pool = Pool()
|
||||
Category = pool.get('party.category')
|
||||
return [('id', 'in', Category.search([clause], query=True))]
|
||||
|
||||
@classmethod
|
||||
def order_name(cls, tables):
|
||||
pool = Pool()
|
||||
@@ -607,6 +622,10 @@ class ProductMixin(object):
|
||||
def get_rec_name(self, name):
|
||||
return self.product.rec_name if self.product else None
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('product.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Product(ProductMixin, Abstract, ModelView):
|
||||
"Sale Reporting per Product"
|
||||
@@ -696,6 +715,10 @@ class ProductCategoryMixin(object):
|
||||
def get_rec_name(self, name):
|
||||
return self.category.rec_name if self.category else None
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('category.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class ProductCategory(ProductCategoryMixin, Abstract, ModelView):
|
||||
"Sale Reporting per Product Category"
|
||||
@@ -726,7 +749,8 @@ class ProductCategoryTree(ModelSQL, ModelView):
|
||||
"Sale Reporting per Product Category"
|
||||
__name__ = 'sale.reporting.product.category.tree'
|
||||
|
||||
name = fields.Function(fields.Char("Name"), 'get_name')
|
||||
name = fields.Function(
|
||||
fields.Char("Name"), 'get_name', searcher='search_name')
|
||||
parent = fields.Many2One('sale.reporting.product.category.tree', "Parent")
|
||||
children = fields.One2Many(
|
||||
'sale.reporting.product.category.tree', 'parent', "Children")
|
||||
@@ -754,6 +778,12 @@ class ProductCategoryTree(ModelSQL, ModelView):
|
||||
categories = Category.browse(categories)
|
||||
return {c.id: c.name for c in categories}
|
||||
|
||||
@classmethod
|
||||
def search_name(cls, name, clause):
|
||||
pool = Pool()
|
||||
Category = pool.get('product.category')
|
||||
return [('id', 'in', Category.search([clause], query=True))]
|
||||
|
||||
@classmethod
|
||||
def order_name(cls, tables):
|
||||
pool = Pool()
|
||||
@@ -871,6 +901,13 @@ class CountryMixin(object):
|
||||
where &= address.country != Null
|
||||
return where
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.country.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('country.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class RegionTree(ModelSQL, ModelView):
|
||||
"Sale Reporting per Region"
|
||||
@@ -1022,9 +1059,6 @@ class Country(CountryMixin, Abstract):
|
||||
address = tables['line.shipment_address']
|
||||
return address.country
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.country.rec_name
|
||||
|
||||
|
||||
class CountryTimeseries(CountryMixin, AbstractTimeseries, ModelView):
|
||||
"Sale Reporting per Country"
|
||||
@@ -1054,6 +1088,13 @@ class SubdivisionMixin(CountryMixin):
|
||||
where &= address.subdivision != Null
|
||||
return where
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.subdivision.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('subdivision.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Subdivision(SubdivisionMixin, Abstract):
|
||||
"Sale Reporting per Subdivision"
|
||||
@@ -1073,9 +1114,6 @@ class Subdivision(SubdivisionMixin, Abstract):
|
||||
address = tables['line.shipment_address']
|
||||
return address.subdivision
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.subdivision.rec_name
|
||||
|
||||
|
||||
class SubdivisionTimeseries(SubdivisionMixin, AbstractTimeseries, ModelView):
|
||||
"Sale Reporting per Subdivision"
|
||||
|
||||
@@ -213,6 +213,9 @@ Check sale reporting per customer categories::
|
||||
... ('Child2', Decimal('10')),
|
||||
... ('Root2', Decimal('30'))])
|
||||
True
|
||||
>>> child1, = CustomerCategoryTree.find([('rec_name', '=', 'Child1')])
|
||||
>>> child1.rec_name
|
||||
'Child1'
|
||||
|
||||
Check sale reporting per product::
|
||||
|
||||
@@ -280,6 +283,9 @@ Check sale reporting per product categories::
|
||||
... ('Root2', Decimal('30')),
|
||||
... ('Account Category', Decimal('40'))])
|
||||
True
|
||||
>>> child1, = ProductCategoryTree.find([('rec_name', '=', 'Child1')])
|
||||
>>> child1.rec_name
|
||||
'Child1'
|
||||
|
||||
Check sale reporting per countries::
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Allow searching reporting by record name
|
||||
|
||||
Version 6.6.0 - 2022-10-31
|
||||
--------------------------
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
@@ -433,6 +433,10 @@ class EmployeeMixin:
|
||||
def get_rec_name(self, name):
|
||||
return self.employee.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('employee.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class ConversionEmployee(EmployeeMixin, AbstractConversion, ModelView):
|
||||
"Sale Opportunity Reporting Conversion per Employee"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Allow searching reporting records by name
|
||||
* Assign all possible shipments when trying
|
||||
* Store warehouse locations on shipments
|
||||
|
||||
|
||||
@@ -413,6 +413,10 @@ class ProductMixin:
|
||||
def get_rec_name(self, name):
|
||||
return self.product.rec_name
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('product.rec_name', *clause[1:])]
|
||||
|
||||
def get_quantity(self, name):
|
||||
return self.unit.round(self.internal_quantity)
|
||||
|
||||
@@ -500,6 +504,10 @@ class CategoryMixin:
|
||||
def get_rec_name(self, name):
|
||||
return self.category.rec_name if self.category else None
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
return [('category.rec_name', *clause[1:])]
|
||||
|
||||
|
||||
class Category(CategoryMixin, Abstract, ModelView):
|
||||
"Stock Reporting Margin per Category"
|
||||
@@ -529,7 +537,8 @@ class CategoryTree(ModelSQL, ModelView):
|
||||
"Stock Reporting Margin per Category"
|
||||
__name__ = 'stock.reporting.margin.category.tree'
|
||||
|
||||
name = fields.Function(fields.Char("Name"), 'get_name')
|
||||
name = fields.Function(
|
||||
fields.Char("Name"), 'get_name', searcher='search_name')
|
||||
parent = fields.Many2One('stock.reporting.margin.category.tree', "Parent")
|
||||
children = fields.One2Many(
|
||||
'stock.reporting.margin.category.tree', 'parent', "Children")
|
||||
@@ -573,6 +582,12 @@ class CategoryTree(ModelSQL, ModelView):
|
||||
categories = Category.browse(categories)
|
||||
return {c.id: c.name for c in categories}
|
||||
|
||||
@classmethod
|
||||
def search_name(cls, name, clause):
|
||||
pool = Pool()
|
||||
Category = pool.get('product.category')
|
||||
return [('id', 'in', Category.search([clause], query=True))]
|
||||
|
||||
@classmethod
|
||||
def order_name(cls, tables):
|
||||
pool = Pool()
|
||||
|
||||
@@ -204,6 +204,9 @@ Check reporting margin per categories::
|
||||
... ('Child2', Decimal('40.00'), Decimal('100.00'),
|
||||
... Decimal('60.00'), Decimal('0.6000'))])
|
||||
True
|
||||
>>> child1, = MarginCategoryTree.find([('rec_name', '=', 'Child1')])
|
||||
>>> child1.rec_name
|
||||
'Child1'
|
||||
|
||||
Check reporting margin including lost::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user