diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-03 10:12:24 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-03 10:12:24 +0700 |
| commit | 4a69c71eab2d4ea3504a0cf6e3a9ca241be48594 (patch) | |
| tree | eb03e833a86acfe72870099d1671ad6dfae86d37 /indoteknik_custom/models/vendor_approval.py | |
| parent | 8b63d79efe0137ce6af535847f33868e73ce8d3c (diff) | |
push
Diffstat (limited to 'indoteknik_custom/models/vendor_approval.py')
| -rw-r--r-- | indoteknik_custom/models/vendor_approval.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/indoteknik_custom/models/vendor_approval.py b/indoteknik_custom/models/vendor_approval.py new file mode 100644 index 00000000..4369a193 --- /dev/null +++ b/indoteknik_custom/models/vendor_approval.py @@ -0,0 +1,39 @@ +from odoo import models, api, fields +from odoo.exceptions import AccessError, UserError, ValidationError +from datetime import timedelta, date +import logging + +_logger = logging.getLogger(__name__) + +class VendorApproval(models.Model): + _name = "vendor.approval" + _description = "Vendor Approval" + _inherit = ['mail.thread'] + _rec_name = 'number' + + number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True) + partner_id = fields.Many2one('res.partner', string="Customer", readonly=True) + order_id = fields.Many2one('sale.order', string="SO", readonly=True) + vendor_approval_line = fields.One2many('vendor.approval.line', 'vendor_approval_id', string='Vendor Approval Lines', auto_join=True) + + def unlink(self): + res = super(VendorApproval, self).unlink() + if not self._name == 'vendor.approval': + raise UserError('Vendor Approval tidak bisa didelete') + return res + + +class VendorApprovalLine(models.Model): + _name = 'vendor.approval.line' + _description = 'Vendor Approval Line' + _order = 'vendor_approval_id, id' + + vendor_approval_id = fields.Many2one('vendor.approval', string='Vendor Approval Ref', required=True, ondelete='cascade', index=True, copy=False) + product_id = fields.Many2one('product.product', string='Product') + product_uom_qty = fields.Float(string='Quantity') + vendor_id = fields.Many2one('res.partner', string='Vendor') + vendor_md_id = fields.Many2one('res.partner', string='Vendor MD') + purchase_price = fields.Many2one(string='Purchase Price') + purchase_price_md= fields.Many2one(string='Purchase Price MD') + + |
