remove useless models
This commit is contained in:
parent
d01295a930
commit
776e5aa8f5
6 changed files with 2 additions and 120 deletions
|
|
@ -1,3 +1,2 @@
|
|||
from . import customer_supplier_requisition
|
||||
from . import purchase_order_line
|
||||
from . import purchase_requisition
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
from odoo import models, fields, api
|
||||
|
||||
class CustomerSupplierRequisition(models.Model):
|
||||
_name = 'customer.supplier.requisition'
|
||||
_description = 'Customer Supplier Requisition Reference'
|
||||
|
||||
customer_id = fields.Many2one(
|
||||
comodel_name='res.partner',
|
||||
string='Customer',
|
||||
required=True,
|
||||
domain=[
|
||||
('customer_rank', '>', 0)
|
||||
]
|
||||
)
|
||||
|
||||
supplier_id = fields.Many2one(
|
||||
comodel_name='res.partner',
|
||||
string='Supplier',
|
||||
required=True,
|
||||
domain=[
|
||||
('supplier_rank', '>', 0)]
|
||||
)
|
||||
|
||||
requisition_ref = fields.Char(
|
||||
string='Requisition Reference',
|
||||
required=True,
|
||||
help='Reference number used by the supplier for this customer'
|
||||
)
|
||||
|
||||
active = fields.Boolean(
|
||||
default=True
|
||||
)
|
||||
|
||||
_sql_constraints = [
|
||||
('unique_customer_supplier', 'unique(customer_id, supplier_id)',
|
||||
'A requisition reference already exists for this customer-supplier pair!')
|
||||
]
|
||||
|
|
@ -5,23 +5,11 @@ class PurchaseOrderLine(models.Model):
|
|||
|
||||
customer_requisition_ref = fields.Char(
|
||||
string='Customer Requisition Ref',
|
||||
compute='_compute_customer_requisition_ref',
|
||||
related='order_id.requisition_id.customer_requisition_ref',
|
||||
store=True,
|
||||
help='Customer requisition reference for this supplier'
|
||||
help='Customer requisition reference'
|
||||
)
|
||||
|
||||
@api.depends('sale_line_id.order_id.partner_id', 'order_id.partner_id')
|
||||
def _compute_customer_requisition_ref(self):
|
||||
for line in self:
|
||||
if line.sale_line_id and line.sale_line_id.order_id.partner_id and line.order_id.partner_id:
|
||||
requisition = self.env['customer.supplier.requisition'].search([
|
||||
('customer_id', '=', line.sale_line_id.order_id.partner_id.id),
|
||||
('supplier_id', '=', line.order_id.partner_id.id)
|
||||
], limit=1)
|
||||
line.customer_requisition_ref = requisition.requisition_ref if requisition else False
|
||||
else:
|
||||
line.customer_requisition_ref = False
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
lines = super().create(vals_list)
|
||||
|
|
|
|||
|
|
@ -12,23 +12,9 @@ class PurchaseRequisition(models.Model):
|
|||
|
||||
customer_requisition_ref = fields.Char(
|
||||
string='Customer Requisition Ref',
|
||||
compute='_compute_customer_requisition_ref',
|
||||
store=True,
|
||||
help='Customer requisition reference'
|
||||
)
|
||||
|
||||
@api.depends('customer_id', 'vendor_id')
|
||||
def _compute_customer_requisition_ref(self):
|
||||
for requisition in self:
|
||||
if requisition.customer_id and requisition.vendor_id:
|
||||
ref = self.env['customer.supplier.requisition'].search([
|
||||
('customer_id', '=', requisition.customer_id.id),
|
||||
('supplier_id', '=', requisition.vendor_id.id)
|
||||
], limit=1)
|
||||
requisition.customer_requisition_ref = ref.requisition_ref if ref else False
|
||||
else:
|
||||
requisition.customer_requisition_ref = False
|
||||
|
||||
def action_in_progress(self):
|
||||
res = super().action_in_progress()
|
||||
for requisition in self:
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_customer_supplier_requisition_user,customer.supplier.requisition.user,model_customer_supplier_requisition,purchase.group_purchase_user,1,0,0,0
|
||||
access_customer_supplier_requisition_manager,customer.supplier.requisition.manager,model_customer_supplier_requisition,purchase.group_purchase_manager,1,1,1,1
|
||||
|
|
|
|||
|
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_customer_supplier_requisition_tree" model="ir.ui.view">
|
||||
<field name="name">customer.supplier.requisition.list</field>
|
||||
<field name="model">customer.supplier.requisition</field>
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="customer_id"/>
|
||||
<field name="supplier_id"/>
|
||||
<field name="requisition_ref"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_customer_supplier_requisition_form" model="ir.ui.view">
|
||||
<field name="name">customer.supplier.requisition.form</field>
|
||||
<field name="model">customer.supplier.requisition</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Customer Supplier Requisition">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="customer_id"/>
|
||||
<field name="supplier_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="requisition_ref"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_customer_supplier_requisition" model="ir.actions.act_window">
|
||||
<field name="name">Customer Supplier Requisitions</field>
|
||||
<field name="res_model">customer.supplier.requisition</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create your first customer supplier requisition reference
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_customer_supplier_requisition"
|
||||
name="Customer Requisitions"
|
||||
action="action_customer_supplier_requisition"
|
||||
parent="purchase.menu_purchase_config"
|
||||
sequence="6"/>
|
||||
</odoo>
|
||||
Loading…
Reference in a new issue