[NEW] Addons creation - Account Quotation Sale Order Invoice Title

This commit is contained in:
Stéphan Sainléger
2022-04-22 10:55:13 +02:00
parent e624c42a5d
commit 5fd1f49891
10 changed files with 254 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import models
from . import wizard

View File

@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
{
"name": "Account Quotation Sale Order Invoice Title",
"category": "Account",
"version": "14.0.1.0",
"summary": "Transfer the Receipt Lost value in invoices and account move lines",
"author": "Elabore",
"website": "https://elabore.coop/",
"installable": True,
"application": False,
"auto_install": False,
"description": """
==========================================
Account Quotation Sale Order Invoice Title
==========================================
This module allows to add a title in Quotations, Sale Orders and Invoices.
When an invoice is created from a Sale Order, the title is transfered.
Installation
============
Just install account_quotation_sale_order_invoice_title, all dependencies will be installed by default.
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/elabore-coop/.../issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Stéphan Sainléger <https://github.com/stephansainleger>
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
* Datactivist (https://datactivist.coop)
Maintainer
----------
This module is maintained by ELABORE.
""",
"depends": [
"base",
"account",
"sale",
],
"data": [
"views/sale_views.xml",
"views/account_move_views.xml",
],
"qweb": [],
}

View File

@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_quotation_sale_order_invoice_title
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-22 08:48+0000\n"
"PO-Revision-Date: 2022-04-22 08:48+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: account_quotation_sale_order_invoice_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_move__display_name
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_order__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_move__id
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_order__id
msgid "ID"
msgstr "ID"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_bank_statement_line__move_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_move__move_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_payment__move_title
msgid "Invoice Title"
msgstr "Titre de la facture"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model,name:account_quotation_sale_order_invoice_title.model_account_move
msgid "Journal Entry"
msgstr "Pièce comptable"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_account_move____last_update
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_order____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model,name:account_quotation_sale_order_invoice_title.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr "Facture de paiement d'avance"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model,name:account_quotation_sale_order_invoice_title.model_sale_order
msgid "Sales Order"
msgstr "Commande"
#. module: account_quotation_sale_order_invoice_title
#: model:ir.model.fields,field_description:account_quotation_sale_order_invoice_title.field_sale_order__so_title
msgid "Title"
msgstr "Titre"
#. module: account_quotation_sale_order_invoice_title
#: model_terms:ir.ui.view,arch_db:account_quotation_sale_order_invoice_title.view_move_title_form
#: model_terms:ir.ui.view,arch_db:account_quotation_sale_order_invoice_title.view_order_form
msgid "Title..."
msgstr "Titre..."

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import account_move
from . import sale

View File

@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class AccountMove(models.Model):
_inherit = 'account.move'
move_title = fields.Char(string="Invoice Title")

View File

@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class SaleOrder(models.Model):
_inherit = "sale.order"
so_title = fields.Char(string="Title")
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
res["move_title"] = self.so_title
return res

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_title_tree" model="ir.ui.view">
<field name="name">amove_title.move.tree</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_invoice_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="move_title" />
</xpath>
</field>
</record>
<record id="view_move_title_form" model="ir.ui.view">
<field name="name">move_title.move.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_title')]" position="after">
<h1 class="mt0">
<field name="move_title" placeholder="Title..." />
</h1>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_title_tree" model="ir.ui.view">
<field name="name">so_title.sale.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="so_title" />
</field>
</field>
</record>
<record id="view_quotation_title_tree" model="ir.ui.view">
<field name="name">so_title.quotation.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="so_title" />
</field>
</field>
</record>
<record id="view_order__title_form" model="ir.ui.view">
<field name="name">so_title.sale_order_form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="class">oe_inline</attribute>
</field>
<xpath expr="//field[@name='name']" position="after">
<field name="so_title" class="oe_inline" placeholder="Title..." />
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import sale_make_invoice_advance

View File

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from odoo import models
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"
def _prepare_invoice_values(self, order, name, amount, so_line):
res = super(SaleAdvancePaymentInv, self)._prepare_invoice_values(
order, name, amount, so_line
)
res["move_title"] = order.so_title
import pdb
pdb.set_trace()
return res