Accept Merge Request #1686: (feature/入库单优化 -> develop)

Merge Request: 1、采购订单form页买家改名为采购员;2、优化成品入库单的的坯料委外加工链接;

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1686
This commit is contained in:
禹翔辉
2024-12-31 08:57:15 +08:00
committed by Coding
3 changed files with 18 additions and 7 deletions

View File

@@ -29,7 +29,12 @@
<xpath expr="//header/button[@name='button_cancel'][2]" position="attributes"> <xpath expr="//header/button[@name='button_cancel'][2]" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute>
</xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<field name="partner_id" position="replace"> <field name="partner_id" position="replace">
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/> <field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
@@ -224,6 +229,9 @@
<xpath expr="//field[@name='user_id']" position="attributes"> <xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute> <attribute name="string">采购员</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<xpath expr="//field[@name='activity_ids']" position="attributes"> <xpath expr="//field[@name='activity_ids']" position="attributes">
<attribute name="optional">hide</attribute> <attribute name="optional">hide</attribute>
</xpath> </xpath>
@@ -281,6 +289,9 @@
<xpath expr="//field[@name='user_id']" position="attributes"> <xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute> <attribute name="string">采购员</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<xpath expr="//field[@name='user_id']" position="after"> <xpath expr="//field[@name='user_id']" position="after">
<field name="delivery_warning" optional="show"/> <field name="delivery_warning" optional="show"/>
<field name="date_planned" string="最近交货日期" optional="show" widget="date"/> <field name="date_planned" string="最近交货日期" optional="show" widget="date"/>

View File

@@ -47,23 +47,23 @@ class StockPicking(models.Model):
}) })
return action return action
pro_out_purchase_count = fields.Integer('坯料外单数量', compute='_compute_pro_out_purchase_count', store=True) pro_out_purchase_count = fields.Integer('坯料外单数量', compute='_compute_pro_out_purchase_count', store=True)
@api.depends('name') @api.depends('name')
def _compute_pro_out_purchase_count(self): def _compute_pro_out_purchase_count(self):
for sp in self: for sp in self:
if sp: if sp:
po_ids = self.env['purchase.order'].sudo().search([ po_ids = self.env['purchase.order'].sudo().search([
('origin', 'like', sp.name), ('purchase_type', '=', 'consignment')]) ('origin', 'like', sp.name), ('purchase_type', '=', 'outsourcing')])
if po_ids: if po_ids:
sp.pro_out_purchase_count = len(po_ids) sp.pro_out_purchase_count = len(po_ids)
def pro_out_purchase_order(self): def pro_out_purchase_order(self):
""" """
坯料外 坯料
""" """
po_ids = self.env['purchase.order'].sudo().search([ po_ids = self.env['purchase.order'].sudo().search([
('origin', 'like', self.name), ('purchase_type', '=', 'consignment')]) ('origin', 'like', self.name), ('purchase_type', '=', 'outsourcing')])
action = { action = {
'res_model': 'purchase.order', 'res_model': 'purchase.order',
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
@@ -75,7 +75,7 @@ class StockPicking(models.Model):
}) })
else: else:
action.update({ action.update({
'name': _("订单列表"), 'name': _("外订单列表"),
'domain': [('id', 'in', po_ids.ids)], 'domain': [('id', 'in', po_ids.ids)],
'view_mode': 'tree,form', 'view_mode': 'tree,form',
}) })

View File

@@ -18,7 +18,7 @@
attrs="{'invisible': [('pro_out_purchase_count', '=', 0)]}"> attrs="{'invisible': [('pro_out_purchase_count', '=', 0)]}">
<div class="o_field_widget o_stat_info"> <div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="pro_out_purchase_count"/></span> <span class="o_stat_value"><field name="pro_out_purchase_count"/></span>
<span class="o_stat_text">坯料外</span> <span class="o_stat_text">坯料</span>
</div> </div>
</button> </button>
</xpath> </xpath>