Merge pull request #2192 from expsa/manar_purchase_dev_22_1

UPDATE purchase_custom_stock
This commit is contained in:
Manar416 2025-01-22 19:20:32 +02:00 committed by GitHub
commit 446e6bce4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 52 additions and 1 deletions

View File

@ -12,6 +12,8 @@
'data/purchase_request.xml',
'views/purchase_request.xml',
'views/stock_warehouse.xml',
'views/stock_picking_view.xml',
'views/report_deliveryslip.xml',
'wizards/picking_purchase_request.xml'
],

View File

@ -1,3 +1,4 @@
from . import purchase_request
from . import stock_warehouse
from . import stock_warehouse
from . import stock_picking

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from odoo.exceptions import UserError, ValidationError
from odoo import api, fields, models, _
class StockPicking(models.Model):
_inherit = "stock.picking"
user_changed_to_done = fields.Many2one('res.users', string="User Who Changed to Done")
def write(self, vals):
res = super(StockPicking, self).write(vals)
if self.state == 'done' and not self.user_changed_to_done:
self.user_changed_to_done = self.env.user.id
return res

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="report_delivery_document_user_changed_to_done" inherit_id="stock.report_delivery_document">
<xpath expr="//div[@name='signature']" position="before">
<div name="user_changed_to_done" dir="rtl" style="float:right;">
<t t-if="o.picking_type_code == 'incoming'">
<strong>مستلم بواسطة:</strong>
<strong t-esc="o.user_changed_to_done.name"/>
</t>
<t t-if="o.picking_type_code == 'outgoing'">
<strong>سلم بواسطة:</strong>
<strong t-esc="o.user_changed_to_done.name"/>
</t>
</div>
</xpath>
</template>
</odoo>

View File

@ -0,0 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="purchase_custom_stock_view_picking_form_inherit_view" model="ir.ui.view">
<field name="name">stock.picking.form.inherit</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="user_changed_to_done" invisible="1"/>
</xpath>
</field>
</record>
</odoo>