优化客户,供应商.销售订单和采购订单权限需求
This commit is contained in:
@@ -6,8 +6,8 @@ import os
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import logging
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo import fields, models, api
|
||||
# from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
|
||||
__author__ = 'jinling.yang'
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -5,8 +5,8 @@ import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
import requests
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
@@ -101,23 +101,23 @@ class RePurchaseOrder(models.Model):
|
||||
vals['check_status'] = 'approved'
|
||||
return super().write(vals)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
# res = super().create(vals_list)
|
||||
if self.env.user.has_group('sf_base.group_purchase'):
|
||||
view = self.env.ref('sf_sale.action_purchase_order_submit_wizard')
|
||||
return {
|
||||
'name': _('确认?'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'purchase.order.wizard',
|
||||
'views': [(view.id, 'form')],
|
||||
'view_id': view.id,
|
||||
'target': 'new',
|
||||
'context': dict(self.env.context),
|
||||
}
|
||||
res = super().create(vals_list)
|
||||
return res
|
||||
# @api.model_create_multi
|
||||
# def create(self, vals_list):
|
||||
# # res = super().create(vals_list)
|
||||
# if self.env.user.has_group('sf_base.group_purchase'):
|
||||
# view = self.env.ref('sf_sale.action_purchase_order_submit_wizard')
|
||||
# return {
|
||||
# 'name': _('确认?'),
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'purchase.order.wizard',
|
||||
# 'views': [(view.id, 'form')],
|
||||
# 'view_id': view.id,
|
||||
# 'target': 'new',
|
||||
# 'context': dict(self.env.context),
|
||||
# }
|
||||
# res = super().create(vals_list)
|
||||
# return res
|
||||
|
||||
|
||||
class ResPartnerToSale(models.Model):
|
||||
@@ -139,9 +139,10 @@ class ResPartnerToSale(models.Model):
|
||||
|
||||
@api.constrains('email')
|
||||
def _check_email(self):
|
||||
obj = self.sudo().search([('email', '=', self.email), ('id', '!=', self.id)])
|
||||
if obj:
|
||||
raise UserError('该邮箱已存在,请重新输入')
|
||||
if self.customer_rank > 0:
|
||||
obj = self.sudo().search([('email', '=', self.email), ('id', '!=', self.id)])
|
||||
if obj:
|
||||
raise UserError('该邮箱已存在,请重新输入')
|
||||
|
||||
@api.model
|
||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<field name="domain_force">['|',('user_id','=',user.id),('create_uid', '=',user.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_purchase'))]"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_write" eval="0"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ access_mrp_bom_byproduct_group_purchase_director,mrp_bom_byproduct_group_purchas
|
||||
access_mrp_bom_byproduct_group_sale_salemanager,mrp_bom_byproduct_group_sale_salemanager,mrp.model_mrp_bom_byproduct,sf_base.group_sale_salemanager,1,0,0,0
|
||||
access_mrp_bom_byproduct_group_sale_director,mrp_bom_byproduct_group_sale_director,mrp.model_mrp_bom_byproduct,sf_base.group_sale_director,1,1,1,0
|
||||
|
||||
access_purchase_order_group_purchase,purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0
|
||||
access_purchase_order_group_purchase_director,purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0
|
||||
|
||||
access_purchase_order_line_group_purchase,purchase_order_line_group_purchase,purchase_stock.model_purchase_order_line,sf_base.group_purchase,1,1,1,0
|
||||
access_purchase_order_line_group_purchase_director,purchase_order_line_group_purchase_director,purchase_stock.model_purchase_order_line,sf_base.group_purchase_director,1,1,1,0
|
||||
access_purchase_order_line_group_sale_salemanager,purchase_order_line_group_sale_salemanager,purchase_stock.model_purchase_order_line,sf_base.group_sale_salemanager,1,0,0,0
|
||||
|
||||
|
@@ -7,67 +7,121 @@
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="currency_id" position="after">
|
||||
<field name="check_status"/>
|
||||
<field name="state"/>
|
||||
<field name="check_status" invisible="1"/>
|
||||
<!-- <field name="state"/>-->
|
||||
<field name="remark"/>
|
||||
</field>
|
||||
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="after">
|
||||
<button name="sf_sale.action_purchase_order_check_wizard" string="审核" type="action"
|
||||
context="{'default_order_id':active_id}" groups="sf_base.group_purchase_director"
|
||||
attrs="{'invisible': ['&',('check_status','in', ['approved']),('state', 'in', ['draft','send'])]}"
|
||||
attrs="{'invisible': ['&',('check_status','in', ['approved']),('state', 'in', ['draft','send','purchase'])]}"
|
||||
class="oe_highlight"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_confirm'][2]" position="replace">
|
||||
<button name="button_confirm" type="object" context="{'validate_analytic': True}"
|
||||
string="确认订单" id="draft_confirm"
|
||||
attrs="{'invisible': ['&',('check_status','in', ['approved',False,'fail']),('state', 'in', ['draft'])]}"
|
||||
attrs="{'invisible': ['|','&',('check_status','in', ['approved','fail']),('state', 'in', ['draft','purchase']),('check_status','=',False ),('state', 'in', ['purchase'])]}"
|
||||
/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//form/header/button[@name='button_confirm[2]']" position="after">-->
|
||||
<!-- <field name="check_status" invisible="1"/>-->
|
||||
<!-- <button name="action_check" string="审核" type="object"-->
|
||||
<!-- attrs="{'invisible': [('check_status','=', 'checked')]}"-->
|
||||
<!-- class="oe_highlight"/>-->
|
||||
<!-- </xpath>-->
|
||||
|
||||
<!-- <xpath expr="//form/header/button[@name='action_rfq_send[1]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//form/header/button[@name='action_rfq_send[2]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//form/header/button[@name='print_quotation[1]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//form/header/button[@name='print_quotation[2]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<xpath expr="//form/header/button[@name='button_approve']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
|
||||
<!-- <xpath expr="//form/header/button[@name='action_create_invoice[1]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//form/header/button[@name='action_create_invoice[2]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<xpath expr="//form/header/button[@name='confirm_reminder_mail']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//form/header/button[@name='button_draft']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_cancel']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//form/header/button[@name='button_unlock']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_done']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase</attribute>
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<field name="partner_ref" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="date_planned" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="receipt_reminder_email" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="user_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="origin" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="payment_term_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="fiscal_position_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="purchase_stock_order_view_form_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.stock.order.form.inherit.sf</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase_stock.purchase_order_view_form_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="incoterm_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="incoterm_location" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user