diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-12 17:05:19 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-12 17:05:19 +0700 |
| commit | 3165c0b329732663cec4a5e9e1951a572cab1a11 (patch) | |
| tree | b3c611ec638e89a758e5221a9d7c108ec4590a00 /fixco_custom | |
| parent | 3a9fdb91554a9b65ae0e9dc14a92cd1a437c7bab (diff) | |
<Miqdad> bills SO number filter
Diffstat (limited to 'fixco_custom')
| -rw-r--r-- | fixco_custom/models/account_move.py | 13 | ||||
| -rw-r--r-- | fixco_custom/views/account_move.xml | 12 |
2 files changed, 20 insertions, 5 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. """ diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index f0ae0bc..3eab56a 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -73,6 +73,7 @@ <field name="partner_id" position="after"> <field name="address" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/> </field> + <field name="amount_untaxed" position="after"> <field name="total_discount"/> </field> @@ -88,6 +89,7 @@ <field name="approval_refund" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('entry'))]}"/> <field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('out_invoice','entry'))]}"/> <field name="purchase_order_id" readonly="1" attrs="{'invisible': [('move_type', 'not in', ('in_invoice','entry'))]}"/> + <field name="soo_number" readonly="1"/> <field name="picking_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/> <field name="bill_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/> </field> @@ -116,10 +118,6 @@ optional="hide"/> </xpath> - <xpath expr="//field[@name='line_ids']/tree/field[@name='company_id']" position="after"> - <field name="purchase_line_id" invisible="1"/> - </xpath> - </field> </record> @@ -155,6 +153,11 @@ filter_domain="[ ('invoice_marketplace', 'ilike', self) ]"/> + <field name="soo_number" + string="SOO Number" + filter_domain="[ + ('soo_number', 'ilike', self) + ]"/> </xpath> </field> @@ -170,6 +173,7 @@ <field name="reklas" optional="hide"/> <field name="reklas_used" optional="hide"/> <field name="reklas_used_by" optional="hide"/> + <field name="soo_number" optional="hide"/> </field> </field> </record> |
