Skip to Content
Menu
This question has been flagged
717 Views
< code report herite form account > 
xml version="1.0" encoding="utf-8"?>


id="soprosys_report_invoice_document">
t-call="web.html_container">
t-foreach="docs" t-as="o">
t-set="lang" t-value="o.partner_id.lang"/>
t-call="soprosys_invoice_with_delivery_slip.report_document_delivery_slip" t-lang="lang"/>



id="report_document_delivery_slip" inherit_id="account.report_invoice_document" primary="True">
expr="//th[@name='th_quantity']" position="before">
class="text-center">Delivery Slip

expr="//td[@name='account_invoice_line_name']" position="after">
style="width:10rem;" class="text-left">
t-foreach="o.invoice_line_ids" t-as="products">
t-if="len(products.picked_ids) != 0 ">
test ok







# -*- coding: utf-8 -*-

from odoo import models, fields, api, _
from odoo.exceptions import RedirectWarning, UserError, ValidationError, AccessError


class SaleOrderInherited(models.Model):
_inherit = 'sale.order'

def _create_invoices(self, grouped=False, final=False):
res = super(SaleOrderInherited, self)._create_invoices()
list_ids = []
for itm in self.picking_ids:
if itm.picking_type_id.code == 'outgoing' and (itm.state == 'done' and not itm.invoice_id):
list_ids.append(itm)
itm.invoice_id = res.id
itm.write({'information_ids': [
(0, 0, {'name': itm.name, 'invoice_id': res.id, 'date_done': itm.date_done, 'section': 'start'})]})
itm.write({"information_ids": [(0, 0, {'product_id': picked.product_id.id,
'product_qty': picked.quantity_done,
'product_uom_id': picked.product_uom.id,
'sale_line_id': picked.sale_line_id.id, 'invoice_id': res.id,
'section': 'line'}) for picked in itm.move_ids_without_package]})
itm.write({'information_ids': [
(0, 0, {'name': itm.name, 'invoice_id': res.id, 'date_done': itm.date_done, 'section': 'end'})]})
return res


class StockPickingInherited(models.Model):
_inherit = "stock.picking"

invoice_id = fields.Many2one("account.move", 'Invoice Id')
information_ids = fields.One2many("picked.information", 'picking_id', "Picked Information")


class AccountMoveInherited(models.Model):
_inherit = "account.move"

picking_ids = fields.One2many("stock.picking", "invoice_id", "Picking Ids")
picked_ids = fields.One2many("picked.information", 'invoice_id', "Picked Line")

class PickedInformation(models.Model):
_name = 'picked.information'

name = fields.Char("Picking Name")
date_done = fields.Datetime('Delivery Date')
product_id = fields.Many2one('product.product', "Product")
product_qty = fields.Float(string='Quantity', default=1.0, digits='Product Unit of Measure')
picking_id = fields.Many2one("stock.picking", "Picking Information")
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure')
sale_line_id = fields.Many2one('sale.order.line', "Sale Line Ids")
section = fields.Char('Line Section')
invoice_id = fields.Many2one('account.move')


Avatar
Discard