diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-26 14:20:48 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-26 14:20:48 +0700 |
| commit | f01c853cec6302fcfce62bab278d1bda57f1f131 (patch) | |
| tree | 0a260211e60322c5e2e6e0c044bee43217e02b23 | |
| parent | 447c98f3079af31a850dd3898190da1063f45cf0 (diff) | |
| parent | a5894d7d55b48e15a2c61759d6ffc04f8ba17c79 (diff) | |
Merge branch 'cr/cr_vendor_approval' into production
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 34 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 47 | ||||
| -rw-r--r-- | indoteknik_custom/models/va_multi_approve.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/va_multi_reject.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/vendor_approval.py | 103 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/form_vendor_approval_multi_approve.xml | 31 | ||||
| -rw-r--r-- | indoteknik_custom/views/form_vendor_approval_multi_reject.xml | 31 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/vendor_approval.xml | 66 |
13 files changed, 275 insertions, 92 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index da44ebf3..89f62524 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -146,6 +146,8 @@ 'views/vendor_approval.xml', 'views/find_page.xml', 'views/approval_retur_picking.xml', + 'views/form_vendor_approval_multi_approve.xml', + 'views/form_vendor_approval_multi_reject.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 4983cc17..ad6d75dd 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -132,3 +132,5 @@ from . import vendor_approval from . import partner from . import find_page from . import approval_retur_picking +from . import va_multi_approve +from . import va_multi_reject diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 3397616d..26dc5102 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -595,10 +595,19 @@ class PurchaseOrder(models.Model): if line.product_uom_qty > line.product_id.plafon_qty + line.product_uom_qty and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError('Product '+line.product_id.name+' melebihi plafon, harus Approval MD') + def check_different_vendor_so_po(self): + vendor_po = self.partner_id.id + for line in self.order_line: + if not line.so_line_id: + continue + if line.so_line_id.vendor_id.id != vendor_po: + raise UserError("Produk "+line.product_id.name+" memiliki vendor berbeda dengan SO (Vendor PO: "+str(self.partner_id.name)+", Vendor SO: "+str(line.so_line_id.vendor_id.name)+")") + def button_confirm(self): res = super(PurchaseOrder, self).button_confirm() current_time = datetime.now() self.check_ppn_mix() + self.check_different_vendor_so_po() # self.check_data_vendor() if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): @@ -736,12 +745,12 @@ class PurchaseOrder(models.Model): template.send_mail(self.id, force_send=True) def po_approve(self): - # if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): - # raise UserError("Hanya Merchandiser yang bisa approve") greater_than_plafon, message = self._get_msg_plafon_qty() + different_vendor_message = self.check_different_vendor_so() # Panggil fungsi check_different_vendor_so + if self.env.user.is_leader or self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError("Bisa langsung Confirm") - elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so and not greater_than_plafon: + elif self.total_percent_margin == self.total_so_percent_margin and self.matches_so and not greater_than_plafon and not different_vendor_message: raise UserError("Bisa langsung Confirm") else: reason = '' @@ -757,13 +766,30 @@ class PurchaseOrder(models.Model): # Check Plafon Qty and Get Message every Line Product if greater_than_plafon: reason += message + # Check for Different Vendor Message + if different_vendor_message: + reason += different_vendor_message + # Post a highlighted message to lognote self.message_post( body=f"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>" - f"<b>Note (Pinned):</b><br>{reason}</div>", + f"<b>Note (Pinned):</b><br>{reason}</div>", subtype_id=self.env.ref("mail.mt_note").id ) + + def check_different_vendor_so(self): + vendor_po = self.partner_id.id + message = '' + for line in self.order_line: + if not line.so_line_id: + continue + if line.so_line_id.vendor_id.id != vendor_po: + product_code = line.product_id.display_name or 'Unknown' + message += (f"Produk {product_code} memiliki vendor berbeda dengan SO " + f"(Vendor PO: {self.partner_id.name}, Vendor SO: {line.so_line_id.vendor_id.name}), ") + return message if message else None + def _get_msg_plafon_qty(self): message = '' greater_than_plafon = False diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index bf5ed8c4..4efb0cd4 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -57,7 +57,7 @@ class PurchasingJob(models.Model): max(pjs.status_apo::text) AS status_apo, max(pjs.note::text) AS note, CASE - WHEN sub.vendor_id = 5571 THEN 27 + WHEN pmp.brand IN ('Tekiro', 'RYU', 'Rexco') THEN 27 WHEN sub.vendor_id = 9688 THEN 397 WHEN sub.vendor_id = 35475 THEN 397 WHEN sub.vendor_id = 29712 THEN 397 diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 5e868edd..315a338a 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -79,7 +79,7 @@ class SaleOrder(models.Model): payment_link_midtrans = fields.Char(string='Payment Link', help='Url payment yg digenerate oleh midtrans, harap diserahkan ke customer agar dapat dilakukan pembayaran secara mandiri') payment_qr_code = fields.Binary("Payment QR Code") due_id = fields.Many2one('due.extension', string="Due Extension", readonly=True, tracking=True) - vendor_approval_id = fields.Many2one('vendor.approval', string="Vendor Approval", readonly=True, tracking=True, copy=False) + vendor_approval_id = fields.Many2many('vendor.approval', string="Vendor Approval", readonly=True, tracking=True, copy=False) customer_type = fields.Selection([ ('pkp', 'PKP'), ('nonpkp', 'Non PKP') @@ -882,29 +882,26 @@ class SaleOrder(models.Model): }).send() def validate_different_vendor(self): - if self.vendor_approval_id and self.vendor_approval_id.state == 'draft': - raise UserError('SO ini sedang dalam review Vendor Approval') - - if self.vendor_approval_id and self.vendor_approval_id.state == 'cancel': - raise UserError('Vendor Approval SO ini Di Reject') - - if self.vendor_approval_id and self.vendor_approval_id.state == 'done': + if self.vendor_approval_id.filtered(lambda v: v.state == 'draft'): + draft_names = ", ".join(self.vendor_approval_id.filtered(lambda v: v.state == 'draft').mapped('number')) + raise UserError(f"SO ini sedang dalam review Vendor Approval: {draft_names}") + + if self.vendor_approval_id and all(v.state != 'draft' for v in self.vendor_approval_id): return False - different_vendor = self.order_line.filtered(lambda l: l.vendor_id and l.vendor_md_id and l.vendor_id.id != l.vendor_md_id.id) + different_vendor = self.order_line.filtered( + lambda l: l.vendor_id and l.vendor_md_id and l.vendor_id.id != l.vendor_md_id.id + ) + if different_vendor: - vendor_approval = self.env['vendor.approval'].create({ - 'order_id': self.id, - 'create_date_so': self.create_date, - 'partner_id': self.partner_id.id, - 'state': 'draft', - }) - - self.vendor_approval_id = vendor_approval.id - + vendor_approvals = [] for line in different_vendor: - self.env['vendor.approval.line'].create({ - 'vendor_approval_id': vendor_approval.id, + vendor_approval = self.env['vendor.approval'].create({ + 'order_id': self.id, + 'order_line_id': line.id, + 'create_date_so': self.create_date, + 'partner_id': self.partner_id.id, + 'state': 'draft', 'product_id': line.product_id.id, 'product_uom_qty': line.product_uom_qty, 'vendor_id': line.vendor_id.id, @@ -916,9 +913,15 @@ class SaleOrder(models.Model): 'margin_after': line.item_percent_margin, 'purchase_tax_id': line.purchase_tax_id.id, 'sales_tax_id': line.tax_id[0].id if line.tax_id else False, - 'percent_margin_difference': (line.price_unit - line.purchase_price_md) / line.purchase_price_md if line.purchase_price_md else False, + 'percent_margin_difference': ( + (line.price_unit - line.purchase_price_md) / line.purchase_price_md + if line.purchase_price_md else False + ), }) - + + vendor_approvals.append(vendor_approval.id) + + self.vendor_approval_id = [(4, vid) for vid in vendor_approvals] return True else: return False diff --git a/indoteknik_custom/models/va_multi_approve.py b/indoteknik_custom/models/va_multi_approve.py new file mode 100644 index 00000000..028358c2 --- /dev/null +++ b/indoteknik_custom/models/va_multi_approve.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class VaMultiApprove(models.TransientModel): + _name = 'va.multi.approve' + + def save_multi_approve_va(self): + va_ids = self._context['va_ids'] + vendor_approval = self.env['vendor.approval'].browse(va_ids) + vendor_approval.action_approve() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Berhasil Di Approve', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file diff --git a/indoteknik_custom/models/va_multi_reject.py b/indoteknik_custom/models/va_multi_reject.py new file mode 100644 index 00000000..c05581bf --- /dev/null +++ b/indoteknik_custom/models/va_multi_reject.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class VaMultiReject(models.TransientModel): + _name = 'va.multi.reject' + + def save_multi_reject_va(self): + va_ids = self._context['va_ids'] + vendor_approval = self.env['vendor.approval'].browse(va_ids) + vendor_approval.action_reject() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Berhasil Di Reject', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file diff --git a/indoteknik_custom/models/vendor_approval.py b/indoteknik_custom/models/vendor_approval.py index 56b81a37..01d2e6a2 100644 --- a/indoteknik_custom/models/vendor_approval.py +++ b/indoteknik_custom/models/vendor_approval.py @@ -13,61 +13,90 @@ class VendorApproval(models.Model): 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_line_id = fields.Many2one('sale.order.line', string="SO Line", 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) state = fields.Selection([('draft', 'Draft'), ('done', 'Done'), ('cancel', 'Reject')], string='State', tracking=True) create_date_so = fields.Datetime(string='Create Date SO', readonly=True) + 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') + sales_price = fields.Float(string='Sales Price') + margin_before = fields.Float(string='Margin Before') + margin_after = fields.Float(string='Margin After') + purchase_price = fields.Float(string='Purchase Price') + purchase_price_md= fields.Float(string='Purchase Price MD') + purchase_tax_id = fields.Many2one('account.tax', string='Purchase Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) + sales_tax_id = fields.Many2one('account.tax', string='Sales Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) + percent_margin_difference = fields.Float(string='Percent Margin Difference') @api.model def create(self, vals): vals['number'] = self.env['ir.sequence'].next_by_code('vendor.approval') or '0' result = super(VendorApproval, self).create(vals) return result + + def check_state_so(self): + for rec in self: + if rec.order_id.state != 'draft': + raise UserError(f"SO {rec.order_id.name} sudah tidak bisa diubah") + def action_approve(self): - if not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): - raise UserError('Hanya Merchandiser yang bisa approve') - - self.state = 'done' - self.order_id.vendor_approval = True - message = "Vendor Approval approved by %s" % (self.env.user.name) - self.order_id.message_post(body=message) - if not self.order_id.due_id and self.order_id.state == 'draft': - self.order_id.action_confirm() + for rec in self: + self.check_state_so() + if not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + raise UserError('Hanya Merchandiser yang bisa approve') + + # Set state menjadi 'done' + rec.state = 'done' + rec.order_id.vendor_approval = True + message = f"Vendor Approval approved by {self.env.user.name}" + rec.order_id.message_post(body=message) + + # Cek semua vendor.approval dengan order_id yang sama + related_approvals = self.env['vendor.approval'].search([('order_id', '=', rec.order_id.id)]) + if all(approval.state != 'draft' for approval in related_approvals): + # Jalankan action_confirm hanya jika semua state bukan draft + if not rec.order_id.due_id and rec.order_id.state == 'draft': + rec.order_id.action_confirm() + def action_reject(self): - if not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): - raise UserError('Hanya Merchandiser yang bisa cancel') - - self.state = 'cancel' + for rec in self: + self.check_state_so() + if not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + raise UserError('Hanya Merchandiser yang bisa cancel') + + rec.state = 'cancel' + + rec.order_line_id.vendor_id = rec.vendor_md_id.id + rec.order_line_id.purchase_price = rec.purchase_price_md - message = "Vendor Approval rejected by %s" % (self.env.user.name) - self.order_id.message_post(body=message) + message = "Vendor Approval rejected by %s" % (self.env.user.name) + self.order_id.message_post(body=message) + + related_approvals = self.env['vendor.approval'].search([('order_id', '=', rec.order_id.id)]) + if all(approval.state != 'draft' for approval in related_approvals): + # Jalankan action_confirm hanya jika semua state bukan draft + if not rec.order_id.due_id and rec.order_id.state == 'draft': + rec.order_id.action_confirm() 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') - sales_price = fields.Float(string='Sales Price') - margin_before = fields.Float(string='Margin Before') - margin_after = fields.Float(string='Margin After') - purchase_price = fields.Float(string='Purchase Price') - purchase_price_md= fields.Float(string='Purchase Price MD') - purchase_tax_id = fields.Many2one('account.tax', string='Purchase Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) - sales_tax_id = fields.Many2one('account.tax', string='Sales Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) - percent_margin_difference = fields.Float(string='Percent Margin Difference') - + def open_form_multi_approve(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_va_multi_approve') + action['context'] = { + 'va_ids': [x.id for x in self] + } + return action + def open_form_multi_reject(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_va_multi_reject') + action['context'] = { + 'va_ids': [x.id for x in self] + } + return action
\ No newline at end of file diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index e817a28d..c2ff2a3b 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -139,10 +139,11 @@ access_account_tax,access.account.tax,model_account_tax,,1,1,1,1 access_approval_unreserve,access.approval.unreserve,model_approval_unreserve,,1,1,1,1 access_approval_unreserve_line,access.approval.unreserve.line,model_approval_unreserve_line,,1,1,1,1 access_vendor_approval,access.vendor.approval,model_vendor_approval,,1,1,1,1 -access_vendor_approval_line,access.vendor.approval.line,model_vendor_approval_line,,1,1,1,1 access_vit_kota,access.vit.kota,model_vit_kota,,1,1,1,1 access_v_brand_product_category,access.v.brand.product.category,model_v_brand_product_category,,1,1,1,1 access_web_find_page,access.web.find.page,model_web_find_page,,1,1,1,1 access_v_requisition_match_po,access.v.requisition.match.po,model_v_requisition_match_po,,1,1,1,1 access_approval_retur_picking,access.approval.retur.picking,model_approval_retur_picking,,1,1,1,1 access_sales_order_fulfillment_v2,access.sales.order.fulfillment.v2,model_sales_order_fulfillment_v2,,1,1,1,1 +access_va_multi_approve,access.va.multi.approve,model_va_multi_approve,,1,1,1,1 +access_va_multi_reject,access.va.multi.reject,model_va_multi_reject,,1,1,1,1 diff --git a/indoteknik_custom/views/form_vendor_approval_multi_approve.xml b/indoteknik_custom/views/form_vendor_approval_multi_approve.xml new file mode 100644 index 00000000..d9be107e --- /dev/null +++ b/indoteknik_custom/views/form_vendor_approval_multi_approve.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="view_va_multi_approve_form" model="ir.ui.view"> + <field name="name">VA Multi Approve</field> + <field name="model">va.multi.approve</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <span>Apakah Anda Yakin Ingin Approve Vendor Approval?</span> + </group> + </sheet> + <footer> + <button name="save_multi_approve_va" string="Update" type="object" default_focus="1" class="oe_highlight"/> + <button string="Cancel" class="btn btn-secondary" special="cancel" /> + </footer> + </form> + </field> + </record> + + <record id="action_va_multi_approve" model="ir.actions.act_window"> + <field name="name">VA Multi Approve</field> + <field name="res_model">va.multi.approve</field> + <field name="type">ir.actions.act_window</field> + <field name="view_mode">form</field> + <field name="view_id" ref="view_va_multi_approve_form"/> + <field name="target">new</field> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/form_vendor_approval_multi_reject.xml b/indoteknik_custom/views/form_vendor_approval_multi_reject.xml new file mode 100644 index 00000000..666de261 --- /dev/null +++ b/indoteknik_custom/views/form_vendor_approval_multi_reject.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="view_va_multi_reject_form" model="ir.ui.view"> + <field name="name">VA Multi Reject</field> + <field name="model">va.multi.reject</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <span>Apakah Anda Yakin Ingin Reject Vendor Approval?</span> + </group> + </sheet> + <footer> + <button name="save_multi_reject_va" string="Update" type="object" default_focus="1" class="oe_highlight"/> + <button string="Cancel" class="btn btn-secondary" special="cancel" /> + </footer> + </form> + </field> + </record> + + <record id="action_va_multi_reject" model="ir.actions.act_window"> + <field name="name">VA Multi Reject</field> + <field name="res_model">va.multi.reject</field> + <field name="type">ir.actions.act_window</field> + <field name="view_mode">form</field> + <field name="view_id" ref="view_va_multi_reject_form"/> + <field name="target">new</field> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 3a3b1c81..e12130de 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -82,7 +82,7 @@ <field name="email" required="1"/> <field name="unreserve_id"/> <field name="due_id" readonly="1"/> - <field name="vendor_approval_id" readonly="1"/> + <field name="vendor_approval_id" readonly="1" widget="many2many_tags"/> <field name="source_id" domain="[('id', 'in', [32, 59, 60, 61])]" required="1"/> <button name="override_allow_create_invoice" string="Override Create Invoice" diff --git a/indoteknik_custom/views/vendor_approval.xml b/indoteknik_custom/views/vendor_approval.xml index 605edfbf..359c67d4 100644 --- a/indoteknik_custom/views/vendor_approval.xml +++ b/indoteknik_custom/views/vendor_approval.xml @@ -5,33 +5,24 @@ <field name="name">vendor.approval.tree</field> <field name="model">vendor.approval</field> <field name="arch" type="xml"> - <tree default_order="create_date desc" create="0"> + <tree default_order="create_date desc" create="0" editable="bottom"> <field name="number"/> <field name="create_date_so"/> <field name="order_id"/> <field name="partner_id"/> - <field name="state"/> - </tree> - </field> - </record> - - <record id="vendor_approval_line_tree" model="ir.ui.view"> - <field name="name">vendor.approval.line.tree</field> - <field name="model">vendor.approval.line</field> - <field name="arch" type="xml"> - <tree> + <field name="state" readonly="1" widget="badge" decoration-danger="state == 'cancel'" decoration-success="state == 'done'"/> <field name="product_id"/> - <field name="sales_price"/> - <field name="product_uom_qty"/> - <field name="sales_tax_id"/> - <field name="margin_after"/> + <field name="sales_price" optional="hide"/> + <field name="product_uom_qty" optional="hide"/> + <field name="sales_tax_id" optional="hide"/> + <field name="margin_after" optional="hide"/> <field name="vendor_id"/> <field name="vendor_md_id"/> - <field name="purchase_price"/> - <field name="purchase_price_md"/> - <field name="margin_before"/> - <field name="purchase_tax_id"/> - <field name="percent_margin_difference"/> + <field name="purchase_price" optional="hide"/> + <field name="purchase_price_md" optional="hide"/> + <field name="margin_before" optional="hide"/> + <field name="purchase_tax_id" optional="hide"/> + <field name="percent_margin_difference" optional="hide"/> </tree> </field> </record> @@ -60,13 +51,22 @@ <field name="order_id" readonly="1"/> <field name="state" readonly="1"/> <field name="create_date_so" readonly="1"/> + <field name="product_id"/> + <field name="sales_price"/> + <field name="product_uom_qty"/> + <field name="sales_tax_id"/> + </group> + <group> + <field name="margin_after"/> + <field name="vendor_id"/> + <field name="vendor_md_id"/> + <field name="purchase_price"/> + <field name="purchase_price_md"/> + <field name="margin_before"/> + <field name="purchase_tax_id"/> + <field name="percent_margin_difference"/> </group> </group> - <notebook> - <page string="SO Line"> - <field name="vendor_approval_line" readonly="1"/> - </page> - </notebook> </sheet> <div class="oe_chatter"> <field name="message_follower_ids" widget="mail_followers"/> @@ -77,7 +77,7 @@ </record> <record id="vendor_approval_view_search" model="ir.ui.view"> - <field name="name">vendor.approval.search.view</field> <!-- Made the name more descriptive --> + <field name="name">vendor.approval.search.view</field> <field name="model">vendor.approval</field> <field name="arch" type="xml"> <search string="Search Vendor Approval"> @@ -102,5 +102,19 @@ sequence="4" action="vendor_approval_action" /> + <record id="vendor_approval_multi_approve_ir_actions_server" model="ir.actions.server"> + <field name="name">Approve</field> + <field name="model_id" ref="model_vendor_approval"/> + <field name="binding_model_id" ref="model_vendor_approval"/> + <field name="state">code</field> + <field name="code">action = records.open_form_multi_approve()</field> + </record> + <record id="vendor_approval_multi_reject_ir_actions_server" model="ir.actions.server"> + <field name="name">Reject</field> + <field name="model_id" ref="model_vendor_approval"/> + <field name="binding_model_id" ref="model_vendor_approval"/> + <field name="state">code</field> + <field name="code">action = records.open_form_multi_reject()</field> + </record> </data> </odoo> |
