diff options
Diffstat (limited to 'fixco_custom/models/account_move.py')
| -rw-r--r-- | fixco_custom/models/account_move.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index 09e4e45..c1098d0 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -60,6 +60,7 @@ class AccountMove(models.Model): string='Partner Compute', compute='_compute_partner_compute', ) + soo_number = fields.Char('SOO Number') @api.depends('line_ids.partner_id') def _compute_partner_compute(self): @@ -295,13 +296,23 @@ class AccountMove(models.Model): def action_post(self): if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8, 22]: raise UserError('Hanya Accounting yang bisa Post') - res = super(AccountMove, self).action_post() + for entry in self: + if entry.move_type == 'in_invoice': + po = entry.invoice_line_ids.mapped('purchase_order_id') + soo_list = list(set(filter(None, po.mapped('soo_number')))) + + entry.soo_number = ', '.join(soo_list) + if entry.move_type == 'out_invoice': if entry.picking_id: entry.invoice_date = entry.picking_id.date_done + + res = super(AccountMove, self).action_post() + return res + @api.onchange('purchase_vendor_bill_ids', 'purchase_id') def _onchange_purchase_auto_complete(self): """ Load from either multiple old purchase orders or vendor bills. """ |
