Commit fb57f372 authored by Sergi Almacellas Abellana's avatar Sergi Almacellas Abellana
Browse files

Add rec_name searcher on reporting models

Closes #11263
parent a98928842010
Pipeline #61766 passed with stages
in 38 minutes and 59 seconds
* Allow searching reporting records by name
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -150,6 +150,13 @@
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"
......
* Allow searching reporting records by name
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -281,6 +281,10 @@
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 @@
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"
......
* Allow searching reporting records by name
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -352,6 +352,10 @@
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 @@
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 @@
"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")
......@@ -495,6 +504,12 @@
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()
Category = pool.get('party.category')
......@@ -607,6 +622,10 @@
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 @@
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 @@
"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")
......@@ -755,6 +779,12 @@
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()
Category = pool.get('product.category')
......@@ -871,6 +901,13 @@
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 @@
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 @@
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 @@
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 @@
... ('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 @@
... ('Root2', Decimal('30')),
... ('Account Category', Decimal('40'))])
True
>>> child1, = ProductCategoryTree.find([('rec_name', '=', 'Child1')])
>>> child1.rec_name
'Child1'
Check sale reporting per countries::
......
* Allow searching reporting by record name
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -433,6 +433,10 @@
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"
......
* Allow searching reporting records by name
* Assign all possible shipments when trying
* Store warehouse locations on shipments
......
......@@ -413,6 +413,10 @@
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 @@
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 @@
"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")
......@@ -574,6 +583,12 @@
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()
Category = pool.get('product.category')
......
......@@ -204,6 +204,9 @@
... ('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::
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment