diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-24 14:08:18 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-24 14:08:18 +0700 |
| commit | 84cbe80ad4f6f2bcb99386d92be7cc210d481dea (patch) | |
| tree | 16605b5ad2941ad59ba6642fd4ed8a9b35eb959d | |
| parent | e0d9fdcfd618332d6324c244859e9cbbf3a6a225 (diff) | |
add real shipping address in sale order and stock picking
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 9 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 48794f92..2151264c 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -36,6 +36,15 @@ class SaleOrder(models.Model): have_outstanding_picking = fields.Boolean('Have Outstanding Picking', compute='_have_outstanding_picking') have_outstanding_po = fields.Boolean('Have Outstanding PO', compute='_have_outstanding_po') purchase_ids = fields.Many2many('purchase.order', string='Purchases', compute='_get_purchases') + real_shipping_id = fields.Many2one( + 'res.partner', string='Real Delivery Address', readonly=True, required=True, + states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]}, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + help="Dipakai untuk alamat tempel") + + @api.onchange('partner_shipping_id') + def onchange_partner_shipping(self): + self.real_shipping_id = self.partner_shipping_id def _get_purchases(self): po_state = ['done', 'draft', 'purchase'] diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 70e9b68a..c1a3f12d 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -14,6 +14,10 @@ class StockPicking(models.Model): summary_qty_operation = fields.Float('Total Qty Operation', compute='_compute_summary_qty') count_line_detail = fields.Float('Total Item Detail', compute='_compute_summary_qty') count_line_operation = fields.Float('Total Item Operation', compute='_compute_summary_qty') + real_shipping_id = fields.Many2one( + 'res.partner', string='Real Delivery Address', required=True, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + help="Dipakai untuk alamat tempel") # Delivery Order driver_departure_date = fields.Datetime( @@ -48,6 +52,11 @@ class StockPicking(models.Model): ('approved', 'Approved'), ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) + def action_assign(self): + res = super(StockPicking, self).action_assign() + self.real_shipping_id = self.sale_id.real_shipping_id + return res + def ask_approval(self): if self.env.user.is_accounting: raise UserError("Bisa langsung Validate") diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e5280ec6..138470b6 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -18,6 +18,7 @@ <field name="delivery_amt"/> </field> <field name="partner_shipping_id" position="after"> + <field name="real_shipping_id"/> <field name="approval_status" /> <field name="sales_tax_id" domain="[('type_tax_use','=','sale')]" required="1"/> <field name="carrier_id"/> diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 1b648d58..3b150f34 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -30,6 +30,9 @@ <field name="summary_qty_detail"/> <field name="count_line_detail"/> </field> + <field name="partner_id" position="after"> + <field name="real_shipping_id"/> + </field> <field name="origin" position="after"> <field name="approval_status"/> <field name="summary_qty_operation"/> |
