add purchase petty
This commit is contained in:
parent
30c8c6754f
commit
c88b231b7f
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "Purchase Petty Invoice",
|
||||
'summary': """Project/Accounting""",
|
||||
'category': 'Odex25-Project/Odex25-Project',
|
||||
'description': """
|
||||
Mark purchase order as paid from petty project
|
||||
""",
|
||||
'version': '0.1',
|
||||
'depends': ['purchase', 'petty_invoice'],
|
||||
'data': [
|
||||
'views/purchase_order_view.xml',
|
||||
],
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_petty_invoice
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-10-27 03:56+0000\n"
|
||||
"PO-Revision-Date: 2024-10-27 03:56+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: purchase_petty_invoice
|
||||
#: model:ir.model,name:purchase_petty_invoice.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "قيد اليومية"
|
||||
|
||||
#. module: purchase_petty_invoice
|
||||
#: model:ir.model.fields,field_description:purchase_petty_invoice.field_purchase_order__is_petty_paid
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_petty_invoice.view_purchase_order_filter
|
||||
msgid "Paid by Petty Cash"
|
||||
msgstr "منصرفه من العهد"
|
||||
|
||||
#. module: purchase_petty_invoice
|
||||
#: model:ir.model,name:purchase_petty_invoice.model_purchase_order
|
||||
msgid "Purchase Order"
|
||||
msgstr "أمر شراء"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import purchase_order
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = "purchase.order"
|
||||
is_petty_paid = fields.Boolean(string='Paid by Petty Cash', default=False, copy=False)
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
@api.onchange('purchase_vendor_bill_id', 'purchase_id')
|
||||
def _onchange_purchase_auto_complete(self):
|
||||
super()._onchange_purchase_auto_complete()
|
||||
if self.purchase_id:
|
||||
self.is_petty_paid = self.purchase_id.is_petty_paid
|
||||
else:
|
||||
self.is_petty_paid = False
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
moves = super(AccountMove, self).create(vals_list)
|
||||
for move in moves:
|
||||
if move.purchase_id:
|
||||
move.is_petty_paid = move.purchase_id.is_petty_paid
|
||||
return moves
|
||||
|
||||
def write(self, vals):
|
||||
if vals.get('purchase_id'):
|
||||
po = self.env['purchase.order'].browse(vals['purchase_id'])
|
||||
vals['is_petty_paid'] = po.is_petty_paid
|
||||
super(AccountMove, self).write(vals)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_purchase_order_filter" model="ir.ui.view">
|
||||
<field name="name">purchase.order.filter.custom</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_id']" position="after">
|
||||
<field name="is_petty_paid"/>
|
||||
<filter name="is_petty_paid" string="Paid by Petty Cash"
|
||||
domain="[('is_petty_paid', '=',True)]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">purchase.order.form.custom</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="is_petty_paid"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue