Hi,
If I use a function to create a ProductCategory:
def _create_account_category(accounts, tax):
ProductCategory = Model.get('product.category')
account_category = ProductCategory(name="Account Category")
account_category.accounting = True
expense = accounts['expense']
revenue = accounts['revenue']
account_category.account_expense = expense
account_category.account_revenue = revenue
account_category.customer_taxes.append(tax)
return account_category
It works like a charm, however, If I try to create the same ProductCategory (with identical input params) through a builder:
class ProductCategoryBuilder:
def __init__(self, **kwargs):
self._result = Model.get('product.category')(**kwargs)
def append_customer_tax(self, tax):
self._result.customer_taxes.append(tax)
return self
def build(self):
return self._result
I get an error like this:
assert record._group is None
when code try to execute that method from buider:
def append_customer_tax(self, tax):
Thoughts?