diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-09 16:23:51 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-09 16:23:51 +0700 |
| commit | 8d482347f6dff03919db3f0a92ba1f3c5eb74ffe (patch) | |
| tree | 35323f6be9a29ba41a6af7e0b2f231e2cbed5f0e /fixco_custom/models/shipment_group.py | |
| parent | ef860cf6815dceb0a806a08b2118390830ccdae0 (diff) | |
shipment group
Diffstat (limited to 'fixco_custom/models/shipment_group.py')
| -rw-r--r-- | fixco_custom/models/shipment_group.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py new file mode 100644 index 0000000..71d7981 --- /dev/null +++ b/fixco_custom/models/shipment_group.py @@ -0,0 +1,33 @@ +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 ShipmentGroup(models.Model): + _name = "shipment.group" + _description = "Shipment Group" + _inherit = ['mail.thread'] + _rec_name = 'number' + + number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True) + shipment_line = fields.One2many('shipment.group.line', 'shipment_id', string='Shipment Group Lines', auto_join=True) + + @api.model + def create(self, vals): + vals['number'] = self.env['ir.sequence'].next_by_code('shipment.group') or '0' + result = super(ShipmentGroup, self).create(vals) + return result + +class ShipmentGroupLine(models.Model): + _name = 'shipment.group.line' + _description = 'Shipment Group Line' + _order = 'shipment_id, id' + + shipment_id = fields.Many2one('shipment.group', string='Shipment Ref', required=True, ondelete='cascade', index=True, copy=False) + product_id = fields.Many2one('product.product', string='Product') + carrier = fields.Char(string='Shipping Method') + invoice_marketplace = fields.Char(string='Invoice Marketplace') + picking_id = fields.Many2one('stock.picking', string='Picking') + |
