quick update
This commit is contained in:
parent
b22e8b417d
commit
9f749b2bf6
|
|
@ -22,7 +22,7 @@
|
|||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='order_line']/list//field[@name='price_unit']" position="after">
|
||||
<field name="purchase_price" groups="base.group_user"/>
|
||||
<field name="purchase_price" groups="base.group_user" force_save="1" readonly="1"/>
|
||||
<field name="bag_weight" groups="base.group_user"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='tax_totals']" position="before">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'Grn Picking Automate',
|
||||
'summary': ' Auto receive stock from grn',
|
||||
'description': '''
|
||||
Auto receive stock from grn
|
||||
''',
|
||||
'author': 'Raman Marikanti',
|
||||
'depends': ['base', 'mail', 'grn'],
|
||||
'data': [
|
||||
'views/grn_picking_automate_views.xml',
|
||||
],
|
||||
'license': 'LGPL-3',
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import grn_picking_automate
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import _,api, fields, models
|
||||
|
||||
|
||||
class GRN(models.Model):
|
||||
_inherit = "grn"
|
||||
|
||||
def button_action_confirm_validate_picking(self):
|
||||
for grn in self:
|
||||
grn.button_action_confirm()
|
||||
grn.button_create_transfer()
|
||||
picking = grn.picking_id
|
||||
if picking.state == 'cancel':
|
||||
continue
|
||||
for move in picking.move_ids:
|
||||
move.quantity = move.product_qty
|
||||
picking._autoconfirm_picking()
|
||||
picking.button_validate()
|
||||
for move_line in picking.move_ids_without_package:
|
||||
move_line.quantity = move_line.product_uom_qty
|
||||
|
||||
for mv_line in picking.move_ids.mapped('move_line_ids'):
|
||||
# if not mv_line.button_validate and mv_line.reserved_qty or mv_line.reserved_uom_qty:
|
||||
mv_line.quantity = mv_line.quantity_product_uom # .reserved_qty or mv_line.reserved_uom_qty
|
||||
|
||||
picking._action_done()
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Sample form view -->
|
||||
<record id="grn_form_view_inherit" model="ir.ui.view">
|
||||
<field name="name">grn.form.inherit</field>
|
||||
<field name="model">grn</field>
|
||||
<field name="inherit_id" ref="grn.grn_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_action_cancel']" position="after">
|
||||
<button name="button_action_confirm_validate_picking" string="Confirm And Validate" type="object" class="btn-secondary" invisible="state in ['done','confirmed']"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import models
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'Sale Picking Automate',
|
||||
'summary': ' Auto delivery stock from sale',
|
||||
'description': '''
|
||||
Auto delivery stock from sale
|
||||
''',
|
||||
'author': 'Raman Marikanti',
|
||||
'depends': ['sale_management', 'stock'],
|
||||
'data': [
|
||||
'views/sale_picking_validate.xml',
|
||||
],
|
||||
'license': 'LGPL-3',
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import sale_picking_validate
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, AccessError, ValidationError
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
invoice_no = fields.Char(string='Invoice No')
|
||||
invoice_date = fields.Datetime(string='Invoice Date')
|
||||
|
||||
def action_confirm_validate_picking(self):
|
||||
for order in self:
|
||||
order.action_confirm()
|
||||
if order.picking_ids:
|
||||
for picking in order.picking_ids.filtered(lambda x:x.state not in ('cancel','done','draft')):
|
||||
if picking.products_availability_state == 'available':
|
||||
for move in picking.move_ids:
|
||||
move.quantity = move.product_qty
|
||||
# picking._autoconfirm_picking()
|
||||
picking.button_validate()
|
||||
for move_line in picking.move_ids_without_package:
|
||||
move_line.quantity = move_line.product_uom_qty
|
||||
|
||||
for mv_line in picking.move_ids.mapped('move_line_ids'):
|
||||
mv_line.quantity = mv_line.quantity_product_uom
|
||||
picking._action_done()
|
||||
order._create_invoices()
|
||||
else:
|
||||
raise ValidationError(_('Some products are not Available'))
|
||||
def _create_invoices(self):
|
||||
res = super(SaleOrder, self)._create_invoices()
|
||||
if res and not self.invoice_no:
|
||||
raise ValidationError(_('Please add Invoice No'))
|
||||
if res and not self.invoice_date:
|
||||
raise ValidationError(_('Please add Invoice Date'))
|
||||
res.name = self.invoice_no
|
||||
res.invoice_date = res.delivery_date = res.invoice_date_due = res.date = self.invoice_date
|
||||
res.action_post()
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="sale_order_form__picking_inherit" model="ir.ui.view">
|
||||
<field name="name">sale.order.form.picking.inherit</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='payment_term_id']" position="after">
|
||||
<field name="invoice_no" readonly="state != 'draft'" force_save="1"/>
|
||||
<field name="invoice_date" readonly="state != 'draft'" force_save="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_unlock']" position="before">
|
||||
<button name="action_confirm_validate_picking" string="Confirm and validate" type="object" context="{'validate_analytic': True}" invisible="state != 'draft'"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue