From 06a4478d69975b8a6eb3d228fa88708448b40a0e Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 31 May 2023 17:14:34 +0700 Subject: Promotion program feature --- indoteknik_custom/models/promotion_program_line.py | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 indoteknik_custom/models/promotion_program_line.py (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py new file mode 100644 index 00000000..3d314f76 --- /dev/null +++ b/indoteknik_custom/models/promotion_program_line.py @@ -0,0 +1,73 @@ +from odoo import fields, models, api + + +class PromotionProgramLine(models.Model): + _name = "promotion.program.line" + + name = fields.Char(string="Name") + image = fields.Binary(string="Image") + product_id = fields.Many2one( + comodel_name="product.product", string="Product Variant") + program_id = fields.Many2one( + comodel_name="promotion.program", string="Program") + discount_type = fields.Selection(selection=[ + ("percentage", "Percentage"), + ("fixed_price", "Fixed Price"), + ], string="Discount Type") + discount_amount = fields.Float(string="Discount Amount") + promotion_type = fields.Selection(selection=[ + ("specific_product", "Specific Product"), + ("bundling", "Bundling"), + ("discount_loading", "Discount Loading"), + ("merchandise", "Merchandise") + ], string="Promotion Type") + minimum_purchase_qty = fields.Integer( + string="Minimum Purchase Qty", help="Minimum Qty to applied discount loading") + applies_multiply = fields.Boolean( + string="Applies Multiply", help="Is applies multiply") + limit_qty = fields.Integer( + string="Limit Qty", help="Limit Qty product in promotion") + limit_qty_user = fields.Integer( + string="Limit Qty / User", help="Limit Qty per User") + limit_qty_transaction = fields.Integer( + string="Limit Qty / Transaction", help="Limit Qty per Transaction") + line_free_item = fields.One2many( + comodel_name="promotion.program.free_item", inverse_name="line_id", string="Line Free Item") + display_on_homepage = fields.Boolean(string="Display on Homepage") + + @api.onchange('product_id') + def _onchange_product_id(self): + if self.product_id and not self.name: + self.name = self.product_id.display_name + self._discount_loading_auto() + + @api.onchange('promotion_type') + def onchange_promotion_type(self): + self._discount_loading_auto() + + def _discount_loading_auto(self): + program_line = self + product = program_line.product_id + promotion_type = program_line.promotion_type + + if promotion_type != 'discount_loading' or not product: + return + + line = self.browse(self.ids) + line.product_id = self.product_id.id + line.promotion_type = self.promotion_type + + product_added = False + line_free_item = program_line.line_free_item + for line in line_free_item: + if line.product_id.id == product.id: + product_added = True + continue + line.unlink() + if not product_added: + data = {'product_id': product.id, + 'qty': 1, 'line_id': program_line.id} + line_free_item.create(data) + + # TODO: Add show on homepage boolean untuk priority specific product + # TODO: Discount loading otomatis membuat line dengan product_id yang sama dengan parent -- cgit v1.2.3 From db7481a490b87e3a1768112395bf096b93969562 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 7 Jun 2023 13:58:24 +0700 Subject: Add promotion program keyword and api homepage promotion --- indoteknik_custom/models/promotion_program_line.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 3d314f76..a8ee2c43 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -68,6 +68,3 @@ class PromotionProgramLine(models.Model): data = {'product_id': product.id, 'qty': 1, 'line_id': program_line.id} line_free_item.create(data) - - # TODO: Add show on homepage boolean untuk priority specific product - # TODO: Discount loading otomatis membuat line dengan product_id yang sama dengan parent -- cgit v1.2.3 From 1f2995a85428ac4335123bd33d48ae17d3c9f36f Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 12 Jun 2023 08:22:10 +0700 Subject: Update promotion program feature --- indoteknik_custom/models/promotion_program_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index a8ee2c43..b6c9a532 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -16,7 +16,7 @@ class PromotionProgramLine(models.Model): ], string="Discount Type") discount_amount = fields.Float(string="Discount Amount") promotion_type = fields.Selection(selection=[ - ("specific_product", "Specific Product"), + ("special_price", "Special Price"), ("bundling", "Bundling"), ("discount_loading", "Discount Loading"), ("merchandise", "Merchandise") -- cgit v1.2.3 From 329668e82ca9e4ebd2ee93d6670380abf6ed6377 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 22 Jun 2023 13:43:42 +0700 Subject: Add program line to order line relation, update remaining_qty response on get product promotion api, show order line on program line --- indoteknik_custom/models/promotion_program_line.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index b6c9a532..8d80bfb0 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -1,4 +1,5 @@ from odoo import fields, models, api +from datetime import datetime class PromotionProgramLine(models.Model): @@ -34,6 +35,7 @@ class PromotionProgramLine(models.Model): line_free_item = fields.One2many( comodel_name="promotion.program.free_item", inverse_name="line_id", string="Line Free Item") display_on_homepage = fields.Boolean(string="Display on Homepage") + order_line_ids = fields.One2many('sale.order.line', 'program_line_id') @api.onchange('product_id') def _onchange_product_id(self): @@ -68,3 +70,52 @@ class PromotionProgramLine(models.Model): data = {'product_id': product.id, 'qty': 1, 'line_id': program_line.id} line_free_item.create(data) + + def get_active_promotions(self, product_id): + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + return self.search([ + ('program_id.start_time', '<=', current_time), + ('program_id.end_time', '>=', current_time), + ('product_id', '=', product_id) + ]) + + def get_remaining_qty(self, line, user): + remaining_qty = { + 'all': line.limit_qty, + 'user': line.limit_qty_user, + 'transaction': line.limit_qty_transaction + } + for order in line.order_line_ids: + parent_order = order.order_id + if parent_order.state != 'cancel': + remaining_qty['all'] -= order.product_uom_qty + if parent_order.partner_id.id == user['partner_id']: + remaining_qty['user'] -= order.product_uom_qty + + if remaining_qty['all'] < remaining_qty['user']: + remaining_qty['user'] = remaining_qty['all'] + if remaining_qty['user'] < remaining_qty['transaction']: + remaining_qty['transaction'] = remaining_qty['user'] + + return remaining_qty + + def res_format(self, lines, user): + ir_attachment = self.env['ir.attachment'] + data = [] + for line in lines: + data.append({ + 'id': line.id, + 'name': line.name, + 'image': ir_attachment.api_image('promotion.program.line', 'image', line.id), + 'type': line.promotion_type, + 'minimum_purchase_qty': line.minimum_purchase_qty, + 'applies_multiply': line.applies_multiply, + 'limit_qty': { + 'all': line.limit_qty, + 'user': line.limit_qty_user, + 'transaction': line.limit_qty_transaction, + }, + 'remaining_qty': self.get_remaining_qty(line, user), + }) + return data + -- cgit v1.2.3 From 751a3684ebf54521daa2edc9f62fca8131c9d653 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 22 Jun 2023 14:32:14 +0700 Subject: Add type value, label and remaining_time on program --- indoteknik_custom/models/promotion_program_line.py | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 8d80bfb0..e6f2f0ea 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -79,17 +79,17 @@ class PromotionProgramLine(models.Model): ('product_id', '=', product_id) ]) - def get_remaining_qty(self, line, user): + def _get_remaining_qty(self, user): remaining_qty = { - 'all': line.limit_qty, - 'user': line.limit_qty_user, - 'transaction': line.limit_qty_transaction + 'all': self.limit_qty, + 'user': self.limit_qty_user, + 'transaction': self.limit_qty_transaction } - for order in line.order_line_ids: + for order in self.order_line_ids: parent_order = order.order_id if parent_order.state != 'cancel': remaining_qty['all'] -= order.product_uom_qty - if parent_order.partner_id.id == user['partner_id']: + if user and parent_order.partner_id.id == user['partner_id']: remaining_qty['user'] -= order.product_uom_qty if remaining_qty['all'] < remaining_qty['user']: @@ -99,6 +99,10 @@ class PromotionProgramLine(models.Model): return remaining_qty + def _get_remaining_time(self): + calculate_time = self.program_id.end_time - datetime.now() + return round(calculate_time.total_seconds()) + def res_format(self, lines, user): ir_attachment = self.env['ir.attachment'] data = [] @@ -107,15 +111,19 @@ class PromotionProgramLine(models.Model): 'id': line.id, 'name': line.name, 'image': ir_attachment.api_image('promotion.program.line', 'image', line.id), - 'type': line.promotion_type, + 'type': { + 'value': line.promotion_type, + 'label': dict(self._fields['promotion_type'].selection).get(line.promotion_type) + }, 'minimum_purchase_qty': line.minimum_purchase_qty, 'applies_multiply': line.applies_multiply, + 'remaining_time': line._get_remaining_time(), 'limit_qty': { 'all': line.limit_qty, 'user': line.limit_qty_user, 'transaction': line.limit_qty_transaction, }, - 'remaining_qty': self.get_remaining_qty(line, user), + 'remaining_qty': line._get_remaining_qty(user), }) return data -- cgit v1.2.3 From ae998f145e4f8b4a0939a97c02e70564ef758e73 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 22 Jun 2023 16:00:25 +0700 Subject: Refactor get promotion by product API --- indoteknik_custom/models/promotion_program_line.py | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index e6f2f0ea..3e419ef9 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -103,6 +103,19 @@ class PromotionProgramLine(models.Model): calculate_time = self.program_id.end_time - datetime.now() return round(calculate_time.total_seconds()) + def _res_limit_qty(self): + return { + 'all': self.limit_qty, + 'user': self.limit_qty_user, + 'transaction': self.limit_qty_transaction, + } + + def _res_promotion_type(self): + return { + 'value': self.promotion_type, + 'label': dict(self._fields['promotion_type'].selection).get(self.promotion_type) + } + def res_format(self, lines, user): ir_attachment = self.env['ir.attachment'] data = [] @@ -111,18 +124,11 @@ class PromotionProgramLine(models.Model): 'id': line.id, 'name': line.name, 'image': ir_attachment.api_image('promotion.program.line', 'image', line.id), - 'type': { - 'value': line.promotion_type, - 'label': dict(self._fields['promotion_type'].selection).get(line.promotion_type) - }, 'minimum_purchase_qty': line.minimum_purchase_qty, 'applies_multiply': line.applies_multiply, 'remaining_time': line._get_remaining_time(), - 'limit_qty': { - 'all': line.limit_qty, - 'user': line.limit_qty_user, - 'transaction': line.limit_qty_transaction, - }, + 'type': line._res_promotion_type(), + 'limit_qty': line._res_limit_qty(), 'remaining_qty': line._get_remaining_qty(user), }) return data -- cgit v1.2.3 From 23014336a1fe1fe5ef54fad30cf6c3d9cc59b2d8 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 23 Jun 2023 11:20:52 +0700 Subject: Update response price di product promotion API, Membuat fungsi calculate price promotion, Refactor promotion homepage, Refactor fungsi calculate product price --- indoteknik_custom/models/promotion_program_line.py | 43 ++++++++++++++-------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 3e419ef9..c888f01a 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -71,6 +71,16 @@ class PromotionProgramLine(models.Model): 'qty': 1, 'line_id': program_line.id} line_free_item.create(data) + def calculate_price(self, price): + initial_price = price['price'] + if self.discount_type == 'percentage': + price['discount_percentage'] = self.discount_amount + price['price_discount'] = initial_price - (initial_price * self.discount_amount / 100) + elif self.discount_type == 'fixed_price': + price['price_discount'] = self.discount_amount + price['discount_percentage'] = round((initial_price - self.discount_amount) / initial_price * 100) + return price + def get_active_promotions(self, product_id): current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') return self.search([ @@ -116,20 +126,23 @@ class PromotionProgramLine(models.Model): 'label': dict(self._fields['promotion_type'].selection).get(self.promotion_type) } - def res_format(self, lines, user): + def format(self, user = None, pricelist = False): ir_attachment = self.env['ir.attachment'] - data = [] - for line in lines: - data.append({ - 'id': line.id, - 'name': line.name, - 'image': ir_attachment.api_image('promotion.program.line', 'image', line.id), - 'minimum_purchase_qty': line.minimum_purchase_qty, - 'applies_multiply': line.applies_multiply, - 'remaining_time': line._get_remaining_time(), - 'type': line._res_promotion_type(), - 'limit_qty': line._res_limit_qty(), - 'remaining_qty': line._get_remaining_qty(user), - }) + product_price = self.product_id.calculate_website_price(pricelist=pricelist) + return { + 'id': self.id, + 'name': self.name, + 'image': ir_attachment.api_image('promotion.program.line', 'image', self.id), + 'minimum_purchase_qty': self.minimum_purchase_qty, + 'applies_multiply': self.applies_multiply, + 'remaining_time': self._get_remaining_time(), + 'type': self._res_promotion_type(), + 'limit_qty': self._res_limit_qty(), + 'remaining_qty': self._get_remaining_qty(user), + 'price': self.calculate_price(price=product_price) + } + + def res_format(self, user, pricelist): + data = [x.format(user, pricelist=pricelist) for x in self] return data - + -- cgit v1.2.3 From 3ed54712ca9856f3be937f8325db030d0796532e Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 23 Jun 2023 14:19:38 +0700 Subject: Refactor pricelist on product price --- indoteknik_custom/models/promotion_program_line.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index c888f01a..55331aea 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -126,9 +126,9 @@ class PromotionProgramLine(models.Model): 'label': dict(self._fields['promotion_type'].selection).get(self.promotion_type) } - def format(self, user = None, pricelist = False): + def format(self, user = None): ir_attachment = self.env['ir.attachment'] - product_price = self.product_id.calculate_website_price(pricelist=pricelist) + product_price = self.product_id.calculate_website_price() return { 'id': self.id, 'name': self.name, @@ -142,7 +142,11 @@ class PromotionProgramLine(models.Model): 'price': self.calculate_price(price=product_price) } - def res_format(self, user, pricelist): - data = [x.format(user, pricelist=pricelist) for x in self] + def res_format(self, user): + data = [x.format(user) for x in self] + return data + + def res_format_cart(self, user): + data = self.format(user) return data -- cgit v1.2.3 From 80da0a90852cc589f5e2f10cc1b7df1c48ddb0b2 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 23 Jun 2023 16:48:08 +0700 Subject: Add used percentage on program line response --- indoteknik_custom/models/promotion_program_line.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 55331aea..e300a5d1 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -129,6 +129,9 @@ class PromotionProgramLine(models.Model): def format(self, user = None): ir_attachment = self.env['ir.attachment'] product_price = self.product_id.calculate_website_price() + limit_qty = self._res_limit_qty() + remaining_qty = self._get_remaining_qty(user) + percent_remaining = (remaining_qty['all'] - limit_qty['all']) / remaining_qty['all'] return { 'id': self.id, 'name': self.name, @@ -137,8 +140,9 @@ class PromotionProgramLine(models.Model): 'applies_multiply': self.applies_multiply, 'remaining_time': self._get_remaining_time(), 'type': self._res_promotion_type(), - 'limit_qty': self._res_limit_qty(), - 'remaining_qty': self._get_remaining_qty(user), + 'limit_qty': limit_qty, + 'remaining_qty': remaining_qty, + 'percent_remaining': percent_remaining, 'price': self.calculate_price(price=product_price) } -- cgit v1.2.3 From 6fbfc93c2297bfa4dcf870ec4d57017d602a5f27 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 23 Jun 2023 16:55:42 +0700 Subject: Fix used_percentage on program line response --- indoteknik_custom/models/promotion_program_line.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index e300a5d1..3ab9b2c0 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -131,7 +131,7 @@ class PromotionProgramLine(models.Model): product_price = self.product_id.calculate_website_price() limit_qty = self._res_limit_qty() remaining_qty = self._get_remaining_qty(user) - percent_remaining = (remaining_qty['all'] - limit_qty['all']) / remaining_qty['all'] + percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100 return { 'id': self.id, 'name': self.name, @@ -142,7 +142,7 @@ class PromotionProgramLine(models.Model): 'type': self._res_promotion_type(), 'limit_qty': limit_qty, 'remaining_qty': remaining_qty, - 'percent_remaining': percent_remaining, + 'used_percentage': percent_remaining, 'price': self.calculate_price(price=product_price) } -- cgit v1.2.3 From d418bd8dd84b91b9dc031819cfa9a2446e77acd2 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 24 Jun 2023 11:22:54 +0700 Subject: Fixing percent remaining on program line --- indoteknik_custom/models/promotion_program_line.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 3ab9b2c0..7aaff4c4 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -131,7 +131,9 @@ class PromotionProgramLine(models.Model): product_price = self.product_id.calculate_website_price() limit_qty = self._res_limit_qty() remaining_qty = self._get_remaining_qty(user) - percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100 + percent_remaining = 0 + if limit_qty['all'] > 0: + percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100 return { 'id': self.id, 'name': self.name, -- cgit v1.2.3 From d966917a5ba95074b6773f49fcb2c3c924296029 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 18 Jul 2023 16:38:29 +0700 Subject: Fix lost merge voucher with promotion program --- indoteknik_custom/models/promotion_program_line.py | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'indoteknik_custom/models/promotion_program_line.py') diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py index 7aaff4c4..077f7e12 100644 --- a/indoteknik_custom/models/promotion_program_line.py +++ b/indoteknik_custom/models/promotion_program_line.py @@ -7,10 +7,8 @@ class PromotionProgramLine(models.Model): name = fields.Char(string="Name") image = fields.Binary(string="Image") - product_id = fields.Many2one( - comodel_name="product.product", string="Product Variant") - program_id = fields.Many2one( - comodel_name="promotion.program", string="Program") + product_id = fields.Many2one(comodel_name="product.product", string="Product Variant") + program_id = fields.Many2one(comodel_name="promotion.program", string="Program") discount_type = fields.Selection(selection=[ ("percentage", "Percentage"), ("fixed_price", "Fixed Price"), @@ -22,18 +20,12 @@ class PromotionProgramLine(models.Model): ("discount_loading", "Discount Loading"), ("merchandise", "Merchandise") ], string="Promotion Type") - minimum_purchase_qty = fields.Integer( - string="Minimum Purchase Qty", help="Minimum Qty to applied discount loading") - applies_multiply = fields.Boolean( - string="Applies Multiply", help="Is applies multiply") - limit_qty = fields.Integer( - string="Limit Qty", help="Limit Qty product in promotion") - limit_qty_user = fields.Integer( - string="Limit Qty / User", help="Limit Qty per User") - limit_qty_transaction = fields.Integer( - string="Limit Qty / Transaction", help="Limit Qty per Transaction") - line_free_item = fields.One2many( - comodel_name="promotion.program.free_item", inverse_name="line_id", string="Line Free Item") + minimum_purchase_qty = fields.Integer(string="Minimum Purchase Qty", help="Minimum Qty to applied discount loading") + applies_multiply = fields.Boolean(string="Applies Multiply", help="Is applies multiply") + limit_qty = fields.Integer(string="Limit Qty", help="Limit Qty product in promotion") + limit_qty_user = fields.Integer(string="Limit Qty / User", help="Limit Qty per User") + limit_qty_transaction = fields.Integer(string="Limit Qty / Transaction", help="Limit Qty per Transaction") + line_free_item = fields.One2many(comodel_name="promotion.program.free_item", inverse_name="line_id", string="Line Free Item") display_on_homepage = fields.Boolean(string="Display on Homepage") order_line_ids = fields.One2many('sale.order.line', 'program_line_id') -- cgit v1.2.3