Procházet zdrojové kódy

Añadir bom en sale order line solucionado

sebas před 3 roky
revize
2740bb6d8b
11 změnil soubory, kde provedl 235 přidání a 0 odebrání
  1. 5 0
      __init__.py
  2. 31 0
      __openerp__.py
  3. 37 0
      i18n/ca.po
  4. 37 0
      i18n/es.po
  5. 35 0
      i18n/sale_mrp_bom.pot
  6. 18 0
      sale_order.xml
  7. 17 0
      sale_order_line.py
  8. 15 0
      sale_order_line.xml
  9. 9 0
      security.xml
  10. 16 0
      static/description/index.html
  11. 15 0
      stock_move.py

+ 5 - 0
__init__.py

@@ -0,0 +1,5 @@
+# -*- encoding: utf-8 -*-
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+import sale_order_line
+import stock_move

+ 31 - 0
__openerp__.py

@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+
+{
+    'name': 'Sale MRP BOM',
+    'version': '8.0.1.0.0',
+    'category': 'Sale',
+    'summary': 'Allows define a BOM in the sales lines',
+    'description': """
+Allows define a BOM in the sales lines.
+	""",
+    'author': 'Akretion, Odoo Community Association (OCA)',
+    'website': 'https://github.com/OCA/sale-workflow',
+    'depends': [
+            'sale_stock',
+            'mrp'
+    ],
+    'data': [
+            'sale_order.xml',
+            'sale_order_line.xml',
+            'security.xml'
+    ],
+    'demo': [
+    ],
+    'test': [
+
+    ],
+    'installable': True,
+    'application': False,
+    'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 37 - 0
i18n/ca.po

@@ -0,0 +1,37 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+#	* sale_mrp_bom
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2021-03-19 17:46+0000\n"
+"Last-Translator: Daniel Martinez Vila <daniel.martinez@qubiq.es>\n"
+"Language-Team: none\n"
+"Language: ca\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.3.2\n"
+
+#. module: sale_mrp_bom
+#: model:res.groups,name:sale_mrp_bom.sale_mrp_bom_group
+msgid "Allows to define a BOM on sale order lines"
+msgstr "Permet definir un BOM a les línies de comanda de venda"
+
+#. module: sale_mrp_bom
+#: model:ir.model.fields,field_description:sale_mrp_bom.field_sale_order_line__bom_id
+msgid "BOM"
+msgstr "LdM"
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_sale_order_line
+msgid "Sales Order Line"
+msgstr "Línia de comandes de vendes"
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_stock_move
+msgid "Stock Move"
+msgstr "Moviment d’estoc"

+ 37 - 0
i18n/es.po

@@ -0,0 +1,37 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+#	* sale_mrp_bom
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2021-03-19 17:46+0000\n"
+"Last-Translator: Daniel Martinez Vila <daniel.martinez@qubiq.es>\n"
+"Language-Team: none\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.3.2\n"
+
+#. module: sale_mrp_bom
+#: model:res.groups,name:sale_mrp_bom.sale_mrp_bom_group
+msgid "Allows to define a BOM on sale order lines"
+msgstr "Permite definir una lista de materiales en líneas de órdenes de venta"
+
+#. module: sale_mrp_bom
+#: model:ir.model.fields,field_description:sale_mrp_bom.field_sale_order_line__bom_id
+msgid "BOM"
+msgstr "LdM"
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_sale_order_line
+msgid "Sales Order Line"
+msgstr "Línea de orden de venta"
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_stock_move
+msgid "Stock Move"
+msgstr "Movimiento de stock"

+ 35 - 0
i18n/sale_mrp_bom.pot

@@ -0,0 +1,35 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+#	* sale_mrp_bom
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \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: sale_mrp_bom
+#: model:res.groups,name:sale_mrp_bom.sale_mrp_bom_group
+msgid "Allows to define a BOM on sale order lines"
+msgstr ""
+
+#. module: sale_mrp_bom
+#: model:ir.model.fields,field_description:sale_mrp_bom.field_sale_order_line__bom_id
+msgid "BOM"
+msgstr ""
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_sale_order_line
+msgid "Sales Order Line"
+msgstr ""
+
+#. module: sale_mrp_bom
+#: model:ir.model,name:sale_mrp_bom.model_stock_move
+msgid "Stock Move"
+msgstr ""
+

+ 18 - 0
sale_order.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+      <record id="sale_order_form" model="ir.ui.view">
+          <field name="name">mrp_sale_bom_eiru.sale.order.form</field>
+          <field name="model">sale.order</field>
+          <field name="inherit_id" ref="sale.view_order_form"/>
+          <field name="arch" type="xml">
+              <xpath expr="//field[@name='order_line']//tree//field[@name='name']" position="after">
+                  <field name="bom_id" groups="mrp_bom_sale_eiru.sale_mrp_bom_group"/>
+              </xpath>
+              <xpath expr="//field[@name='order_line']//form//field[@name='name']" position="after">
+                  <field name="bom_id" groups="mrp_bom_sale_eiru.sale_mrp_bom_group"/>
+              </xpath>
+          </field>
+      </record>
+    </data>
+</openerp>

+ 17 - 0
sale_order_line.py

@@ -0,0 +1,17 @@
+# -*- encoding: utf-8 -*-
+# Copyright 2020 Akretion Renato Lima <renato.lima@akretion.com.br>
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api, _
+
+
+class SaleOrderLine(models.Model):
+    _inherit = 'sale.order.line'
+
+    bom_id = fields.Many2one(
+        comodel_name='mrp.bom',
+        string='BOM',
+        domain="[('product_tmpl_id.product_variant_ids', '=', product_id),"
+               "'|', ('product_id', '=', product_id), "
+               "('product_id', '=', False)]",
+    )

+ 15 - 0
sale_order_line.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="sale_order_line_tree" model="ir.ui.view">
+            <field name="name">mrp_sale_bom.sale.order.line.tree</field>
+            <field name="model">sale.order.line</field>
+            <field name="inherit_id" ref="sale.view_order_line_tree"/>
+            <field name="arch" type="xml">
+                <field name="name" position="after">
+                    <field name="bom_id" groups="mrp_bom_sale_eiru.sale_mrp_bom_group"/>
+                </field>
+            </field>
+         </record>
+      </data>
+  </openerp>

+ 9 - 0
security.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+      <data noupdate="1">
+          <record id="sale_mrp_bom_group" model="res.groups">
+              <field name="name">Allows to define a BOM on sale order lines</field>
+              <field name="category_id" ref="base.module_category_hidden"/>
+          </record>
+        </data>
+  </openerp>

+ 16 - 0
static/description/index.html

@@ -0,0 +1,16 @@
+<section class="oe_container">
+    <div class="oe_row oe_spaced">
+        <div class="oe_span12">
+            <h2 class="oe_slogan">Sale Fast Confirm</h2>
+            <h3 class="oe_slogan">Auto confirm invoice, delivery orders</h3>
+        </div>
+        <div class="oe_span6">
+            <p class="oe_mt32">
+After confirming sale order, automatically creates invoice, validates it. If there are delivery orders, it also confirms it too.
+            </p>
+            <div class="oe_centeralign oe_websiteonly">
+                <a href="http://www.oerp.eu/#trial" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
+            </div>
+        </div>
+    </div>
+</section>

+ 15 - 0
stock_move.py

@@ -0,0 +1,15 @@
+# -*- encoding: utf-8 -*-
+# Copyright 2020 Akretion Renato Lima <renato.lima@akretion.com.br>
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields, api, _
+
+
+class StockMove(models.Model):
+    _inherit = 'stock.move'
+
+    def _prepare_procurement_values(self):
+        values = super()._prepare_procurement_values()
+        if self.sale_line_id and self.sale_line_id.bom_id:
+            values['bom_id'] = self.sale_line_id.bom_id
+        return values