Skip to content

Commit

Permalink
Quitando metodo anglosajon y agregando direccion y nit al reporte de pos
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayhanJC committed Jan 11, 2019
1 parent 4216417 commit ef561af
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 68 deletions.
Binary file removed models/__init__.pyc
Binary file not shown.
Binary file removed models/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file removed models/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed models/__pycache__/point_of_sale.cpython-36.pyc
Binary file not shown.
Binary file removed models/__pycache__/point_of_sale.cpython-37.pyc
Binary file not shown.
66 changes: 2 additions & 64 deletions models/point_of_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,7 @@ def _create_account_move_line(self, session=None, move_id=None):
else:
taxes[key]['amount'] += val['amount']
# taxes[key]['subtotal'] += val['subtotal']

if order.company_id.anglo_saxon_accounting:
for i_line in order.lines:
anglo_saxon_lines = order._anglo_saxon_sale_move_lines(i_line)
all_lines.extend(anglo_saxon_lines)

_logger.info('verificando taxesss')
_logger.info(taxes)


for key, val in taxes.items():
type, dummy, dummy = key
if type in 'out_refund':
Expand Down Expand Up @@ -310,54 +302,6 @@ def _create_account_move_line(self, session=None, move_id=None):
#move.post()
return res

@api.model
def _anglo_saxon_sale_move_lines(self, i_line):
"""Return the additional move lines for sales invoices and refunds.
i_line: An account.invoice.line object.
res: The move line entries produced so far by the parent move_line_get.
"""
order = i_line.order_id
company_currency = order.company_id.currency_id.id

if i_line.product_id.type in ('product', 'consu'): # and i_line.product_id.valuation == 'real_time':
fpos = i_line.order_id.fiscal_position_id
accounts = i_line.product_id.product_tmpl_id.get_product_accounts(fiscal_pos=fpos)
# debit account dacc will be the output account

dacc = accounts['stock_output'].id
# credit account cacc will be the expense account
cacc = accounts['expense'].id
if dacc and cacc:
price_unit = i_line._get_anglo_saxon_price_unit() or 0.0
price = self.env['pos.order.line']._get_price(order, company_currency, i_line, price_unit)
return [
(0, 0, {
'name': i_line.name[:64],
'debit': ((price < 0) and -price) or 0.0,
'credit': ((price > 0) and price) or 0.0,
'account_id': dacc,
'quantity': i_line.qty,
'product_id': i_line.product_id.id,
'product_uom_id': i_line.product_id.uom_id.id,
'partner_id': order.partner_id and self.env["res.partner"]._find_accounting_partner(
order.partner_id).id or False,
'move_id': order.account_move.id
}),
(0, 0, {
'name': i_line.name[:64],
'debit': ((price > 0) and price) or 0.0,
'credit': ((price < 0) and -price) or 0.0,
'account_id': cacc,
'quantity': i_line.qty,
'product_id': i_line.product_id.id,
'product_uom_id': i_line.product_id.uom_id.id,
'partner_id': order.partner_id and self.env["res.partner"]._find_accounting_partner(
order.partner_id).id or False,
'move_id': order.account_move.id
}),
]
return []


class PosOrderLine(models.Model):
Expand Down Expand Up @@ -818,10 +762,4 @@ def default_get(self, vals):
'cashbox_lines_ids': _cashbox_lines_ids
})

return result






return result
Binary file removed models/point_of_sale.pyc
Binary file not shown.
16 changes: 12 additions & 4 deletions static/src/js/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,31 @@ odoo.define('l10n_co_pos_tax.sequence', function(require) {
return _super;
},
export_for_printing: function() {
console.log("-...............................");
console.log(this.pos.company_partner);
console.log(this.pos.dian_resolution_sequence);
var receipt = __super__.export_for_printing.apply(this);
var company_partner = this.pos.company_partner;
var dian_resolution_sequence;

console.log('prueba nombre');
console.log(company_partner);
console.log(company_partner[0]['street']);
console.log(company_partner[0]);

if(this.get_total_with_tax() < 0) {
dian_resolution_sequence = this.pos.dian_resolution_sequence_refund;
} else {
dian_resolution_sequence = this.pos.dian_resolution_sequence;
}

if(company_partner.street) {
var street = company_partner.street.split(",").map(function(text) { return text.trim() + '<br />'; });
if(company_partner[0]['street']) {
console.log('prueba');
var street = company_partner[0]['street'].split(",").map(function(text) { return text.trim() + '<br />'; });
receipt.company.street = street.join("");

} else {
receipt.company.street = "compañía sin dirección";
receipt.company.street = "Compañía sin Dirección";
}


Expand All @@ -166,7 +174,7 @@ odoo.define('l10n_co_pos_tax.sequence', function(require) {
}
}

receipt.company.formatedNit = company_partner.formatedNit ? company_partner.formatedNit : "no posee";
receipt.company.formatedNit = company_partner[0]['formatedNit'] ? company_partner[0]['formatedNit'] : "No tiene NIT";
//receipt.company.formatedNit = "no posee";

if (!this.number_next_dian) {
Expand Down

0 comments on commit ef561af

Please sign in to comment.