summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/price_group.py
blob: fce78fff9316ac1923ba327b34e6c38ebfc72067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from odoo import fields, models, api
from odoo.exceptions import UserError
import logging

_logger = logging.getLogger(__name__)


class PriceGroup(models.Model):
    _name = 'price.group'
    
    name = fields.Char(string='Name')
    pricelist_id = fields.Many2one('product.pricelist', string='Price List')
    group1 = fields.Float(string='Kelompok 1 (%)')
    group2 = fields.Float(string='Kelompok 2 (%)')
    group3 = fields.Float(string='Kelompok 3 (%)')
    group4 = fields.Float(string='Kelompok 4 (%)')
    group5 = fields.Float(string='Kelompok 5 (%)')
    group6 = fields.Float(string='Kelompok 6 (%)')
    group7 = fields.Float(string='Kelompok 7 (%)')
    group8 = fields.Float(string='Kelompok 8 (%)')
    group9 = fields.Float(string='Kelompok 9 (%)')
    group10 = fields.Float(string='Kelompok 10 (%)')
    
    def collect_price_group(self):
        PRICE_GROUP_ID = {
            'markup': 1,
            'tier_1': 2,
            'tier_2': 3,
            'tier_3': 4,
            'tier_4': 5,
            'tier_5': 6,
        }
        
        result = {}
        for key in PRICE_GROUP_ID:
            result[key] = self.env['price.group'].browse(PRICE_GROUP_ID[key])
        
        return result
    
class Manufacture(models.Model):
    _inherit = 'x_manufactures'
    
    pricing_group = fields.Selection([
        ('group1', 'Kelompok 1'),
        ('group2', 'Kelompok 2'),
        ('group3', 'Kelompok 3'),
        ('group4', 'Kelompok 4'),
        ('group5', 'Kelompok 5'),
        ('group6', 'Kelompok 6'),
        ('group7', 'Kelompok 7'),
        ('group8', 'Kelompok 8'),
        ('group9', 'Kelompok 9'),
        ('group10', 'Kelompok 10'),
    ], string='Pricing Group', copy=False)