diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-12-14 15:42:41 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-12-14 15:42:41 +0700 |
| commit | 1a68a5e600e2f7f90bee44144557f6af2f35618c (patch) | |
| tree | d0f3414e583284be53c5d089f2a938e35ba86ece /indoteknik_custom/models/automatic_purchase.py | |
| parent | ce2b8502ab85419096dda2bffaffbec4a096a99f (diff) | |
add some field in automatic purchase
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 502761e0..63eefb93 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -9,7 +9,10 @@ _logger = logging.getLogger(__name__) class AutomaticPurchase(models.Model): _name = 'automatic.purchase' _order = 'id desc' + _inherit = ['mail.thread'] + _rec_name = 'number' + number = fields.Char(string='Document No', index=True, copy=False, readonly=True) date_doc = fields.Date(string='Date', required=True, help='Isi tanggal hari ini') description = fields.Char(string='Description', help='bebas isi nya apa') purchase_lines = fields.One2many('automatic.purchase.line', 'automatic_purchase_id', string='Lines', auto_join=True) @@ -18,6 +21,16 @@ class AutomaticPurchase(models.Model): purchase_match = fields.One2many('automatic.purchase.match', 'automatic_purchase_id', string='Matches', auto_join=True) vendor_id = fields.Many2one('res.partner', string='Vendor', help='boleh kosong, jika diisi, maka hanya keluar data untuk vendor tersebut') responsible_id = fields.Many2one('res.users', string='Responsible', required=True) + apo_type = fields.Selection([ + ('regular', 'Regular Fulfill SO'), + ('reordering', 'Reordering Rule'), + ], string='Type') + + @api.model + def create(self, vals): + vals['number'] = self.env['ir.sequence'].next_by_code('automatic.purchase') or '0' + result = super(AutomaticPurchase, self).create(vals) + return result def create_po_from_automatic_purchase(self): if not self.purchase_lines: @@ -84,6 +97,7 @@ class AutomaticPurchase(models.Model): self.is_po = True def generate_automatic_purchase(self): + # for reordering rule only if self.purchase_lines: raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu') |
